/src/test/png_test.c

http://ftk.googlecode.com/ · C · 18 lines · 15 code · 3 blank · 0 comment · 2 complexity · 6e60f4f62f073a029dcecb84a1d0f3eb MD5 · raw file

  1. #include "ftk.h"
  2. #include "ftk_image_png_decoder.h"
  3. int main(int argc, char* argv[])
  4. {
  5. FtkBitmap* bitmap = NULL;
  6. const char* filename = argv[1];
  7. ftk_set_allocator(ftk_allocator_default_create());
  8. FtkImageDecoder* thiz = ftk_image_png_decoder_create();
  9. assert(ftk_image_decoder_match(thiz, filename) == RET_OK);
  10. assert((bitmap = ftk_image_decoder_decode(thiz, filename)) != NULL);
  11. printf("w=%d h=%d\n", ftk_bitmap_width(bitmap), ftk_bitmap_height(bitmap));
  12. ftk_bitmap_unref(bitmap);
  13. ftk_image_decoder_destroy(thiz);
  14. return 0;
  15. }