Exemplo n.º 1
0
bool Image::IsPng(InputStream input) {
  unsigned char tag[8];
  bool is_png = (input.LookAheadReadChars(0, 8, tag) == 8 && !png_sig_cmp(tag, 0, 8));
  return is_png;
}
Exemplo n.º 2
0
bool Image::IsTga(InputStream input) {
  unsigned char tag[3];
  bool is_tga = (input.LookAheadReadChars(0, 3, tag) == 3 && tag[1] == 0 &&
                 (tag[2] == 2 || tag[2] == 10));
  return is_tga;
}
Exemplo n.º 3
0
// Returns whether a input is pointing to a GIF file. The file pointer location is not changed.
bool Image::IsGif(InputStream input) {
  unsigned char tag[6];
  bool is_gif = (input.LookAheadReadChars(0, 6, tag) == 6 && memcmp(tag, "GIF", 3) == 0 &&
                 (memcmp(tag+3, "87a", 3) == 0 || (memcmp(tag+3, "89a", 3) == 0)));
  return is_gif;
}
Exemplo n.º 4
0
// Returns whether a input is pointing to a JPG file. The file pointer location is not changed.
bool Image::IsJpg(InputStream input) {
  unsigned char tag[3];
  bool is_jpg = (input.LookAheadReadChars(0, 3, tag) == 3 && tag[0] == 0xFF &&
                 tag[1] == 0xD8 && tag[2] == 0xFF);
  return is_jpg;
}
Exemplo n.º 5
0
// Returns whether a input is pointing to a BMP file. The file pointer location is not changed.
bool Image::IsBmp(InputStream input) {
  char tag[2];
  bool is_bmp = (input.LookAheadReadChars(0, 2, tag) == 2 && tag[0] == 'B' && tag[1] == 'M');
  return is_bmp;
}