cmyk.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* GdkPixbuf library - JPEG2000 Image Loader
  2. *
  3. * Copyright © 2020 Nichlas Severinsen
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <gdk-pixbuf/gdk-pixbuf.h>
  20. gint main(gint argc, gchar **argv)
  21. {
  22. int width, height, rowstride, components;
  23. guchar *pixels;
  24. GError *error = NULL;
  25. gchar **env = g_get_environ();
  26. g_warning("%s", g_environ_getenv(env, "TEST_FILE"));
  27. GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(g_environ_getenv(env, "TEST_FILE"), &error);
  28. if(error)
  29. {
  30. g_error("%s", error->message);
  31. }
  32. g_assert(error == NULL);
  33. components = gdk_pixbuf_get_n_channels (pixbuf);
  34. pixels = gdk_pixbuf_get_pixels(pixbuf);
  35. g_assert(gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB);
  36. g_assert(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8);
  37. g_assert(!gdk_pixbuf_get_has_alpha(pixbuf));
  38. g_assert(components == 3);
  39. g_assert(pixels[0] == 255);
  40. g_assert(pixels[1] == 255);
  41. g_assert(pixels[2] == 255);
  42. g_strfreev(env);
  43. g_object_unref(pixbuf);
  44. return 0;
  45. }