Exemplo n.º 1
0
//==============================================================
// 로드
void CDIB::LoadFromFile(wstring file_name) {
	if (!FileExists(file_name)) return;
	file_name=ToUpper(file_name);	
	if (EndsWith(file_name, L".BMP")) LoadBMPFile(file_name); else
	if (EndsWith(file_name, L".PNG")) LoadPNGFile(file_name);
	if (EndsWith(file_name, L".JPG") || EndsWith(file_name, L".JPEG")) LoadJPEGFile(file_name);
}
Exemplo n.º 2
0
Bitmap::Bitmap(ConstBuffer<void> _buffer)
  :
#ifdef ENABLE_OPENGL
#ifdef ANDROID
  id(0),
#endif
  texture(nullptr), interpolation(false)
#else
  buffer(WritableImageBuffer<BitmapPixelTraits>::Empty())
#endif
{
  Load(_buffer);
}

bool
Bitmap::Load(ConstBuffer<void> buffer, Type type)
{
  const UncompressedImage uncompressed = LoadPNG(buffer.data, buffer.size);
  return Load(uncompressed, type);
}

static UncompressedImage
DecompressImageFile(Path path)
{
#ifdef USE_LIBTIFF
  if (path.MatchesExtension(_T(".tif")) || path.MatchesExtension(_T(".tiff")))
    return LoadTiff(path);
#endif

  if (path.MatchesExtension(_T(".png")))
    return LoadPNG(path);

  return LoadJPEGFile(path);
}

bool
Bitmap::LoadFile(Path path)
{
  const UncompressedImage uncompressed = DecompressImageFile(path);
  return uncompressed.IsVisible() && Load(uncompressed);
}
Exemplo n.º 3
0
Bitmap::Bitmap(ConstBuffer<void> _buffer)
  :
#ifdef ENABLE_OPENGL
#ifdef ANDROID
  id(0),
#endif
  texture(nullptr), interpolation(false)
#else
  buffer(WritableImageBuffer<BitmapPixelTraits>::Empty())
#endif
{
  Load(_buffer);
}

bool
Bitmap::Load(ConstBuffer<void> buffer, Type type)
{
  const UncompressedImage uncompressed = LoadPNG(buffer.data, buffer.size);
  return (uncompressed.IsVisible() && Load(uncompressed, type));
}

#ifdef USE_LIBJPEG
bool
Bitmap::LoadFile(const TCHAR *path)
{
  const UncompressedImage uncompressed = LoadJPEGFile(path);
  return (uncompressed.IsVisible() && Load(uncompressed));
}
#endif

bool
Bitmap::LoadPNGFile(const TCHAR *path)
{
  const UncompressedImage uncompressed = ::LoadPNGFile(path);
  return (uncompressed.IsVisible() && Load(uncompressed));
}