+
+png_uint_32 PNGAPI
+png_get_cHRM_XYZ(png_structp png_ptr, png_const_infop info_ptr,
+ double *red_X, double *red_Y, double *red_Z, double *green_X,
+ double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
+ double *blue_Z)
+{
+ png_XYZ XYZ;
+
+ if (png_get_cHRM_XYZ_fixed(png_ptr, info_ptr,
+ &XYZ.redX, &XYZ.redY, &XYZ.redZ, &XYZ.greenX, &XYZ.greenY, &XYZ.greenZ,
+ &XYZ.blueX, &XYZ.blueY, &XYZ.blueZ) & PNG_INFO_cHRM)
+ {
+ if (red_X != NULL)
+ *red_X = png_float(png_ptr, XYZ.redX, "cHRM red X");
+ if (red_Y != NULL)
+ *red_Y = png_float(png_ptr, XYZ.redY, "cHRM red Y");
+ if (red_Z != NULL)
+ *red_Z = png_float(png_ptr, XYZ.redZ, "cHRM red Z");
+ if (green_X != NULL)
+ *green_X = png_float(png_ptr, XYZ.greenX, "cHRM green X");
+ if (green_Y != NULL)
+ *green_Y = png_float(png_ptr, XYZ.greenY, "cHRM green Y");
+ if (green_Z != NULL)
+ *green_Z = png_float(png_ptr, XYZ.greenZ, "cHRM green Z");
+ if (blue_X != NULL)
+ *blue_X = png_float(png_ptr, XYZ.blueX, "cHRM blue X");
+ if (blue_Y != NULL)
+ *blue_Y = png_float(png_ptr, XYZ.blueY, "cHRM blue Y");
+ if (blue_Z != NULL)
+ *blue_Z = png_float(png_ptr, XYZ.blueZ, "cHRM blue Z");
+ return (PNG_INFO_cHRM);
+ }
+
+ return (0);
+}
+# endif
+
+# ifdef PNG_FIXED_POINT_SUPPORTED
+png_uint_32 PNGAPI
+png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
+ png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
+ png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
+ png_fixed_point *blue_x, png_fixed_point *blue_y)
+{
+ png_debug1(1, "in %s retrieval function", "cHRM");
+
+ if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
+ {
+ if (white_x != NULL)
+ *white_x = info_ptr->x_white;
+ if (white_y != NULL)
+ *white_y = info_ptr->y_white;
+ if (red_x != NULL)
+ *red_x = info_ptr->x_red;
+ if (red_y != NULL)
+ *red_y = info_ptr->y_red;
+ if (green_x != NULL)
+ *green_x = info_ptr->x_green;
+ if (green_y != NULL)
+ *green_y = info_ptr->y_green;
+ if (blue_x != NULL)
+ *blue_x = info_ptr->x_blue;
+ if (blue_y != NULL)
+ *blue_y = info_ptr->y_blue;
+ return (PNG_INFO_cHRM);
+ }
+
+ return (0);
+}
+# endif