Rev 6733 | Rev 6780 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6733 | Rev 6779 | ||
---|---|---|---|
Line 806... | Line 806... | ||
806 | .end0: |
806 | .end0: |
807 | end if |
807 | end if |
808 | } |
808 | } |
809 | 809 | ||
Line 810... | Line -... | ||
810 | ; Allocate and initialize png_ptr struct for reading, and any other memory. |
- | |
811 | ;PNG_EXPORTA(4, png_structp, png_create_read_struct, |
- | |
812 | ; (charp user_png_ver, voidp error_ptr, |
- | |
813 | ; png_error_ptr error_fn, png_error_ptr warn_fn), |
- | |
814 | ; PNG_ALLOCATED); |
- | |
815 | - | ||
816 | ; Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp |
- | |
817 | ; match up. |
- | |
818 | - | ||
819 | ; Read the information before the actual image data. |
- | |
820 | PNG_EXPORT 22, void, png_read_info, '(png_structrp png_ptr, png_inforp info_ptr)' |
- | |
821 | - | ||
822 | ; Convert to a US string format: there is no localization support in this |
- | |
823 | ; routine. The original implementation used a 29 character buffer in |
- | |
824 | ; png_struct, this will be removed in future versions. |
- | |
825 | - | ||
826 | ;#if PNG_LIBPNG_VER < 10700 |
- | |
827 | ; To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) |
- | |
828 | ;PNG_EXPORTA(23, charp, png_convert_to_rfc1123, (png_structrp png_ptr, |
- | |
829 | ; png_const_timep ptime),PNG_DEPRECATED); |
- | |
830 | ;end if |
- | |
831 | - | ||
832 | ; Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. |
- | |
833 | PNG_EXPORT 26, void, png_set_expand, '(png_structrp png_ptr)' |
- | |
834 | PNG_EXPORT 27, void, png_set_expand_gray_1_2_4_to_8, '(png_structrp png_ptr)' |
- | |
835 | PNG_EXPORT 28, void, png_set_palette_to_rgb, '(png_structrp png_ptr)' |
- | |
836 | PNG_EXPORT 29, void, png_set_tRNS_to_alpha, '(png_structrp png_ptr)' |
- | |
837 | - | ||
838 | ; Expand to 16-bit channels, forces conversion of palette to RGB and expansion |
- | |
839 | ; of a tRNS chunk if present. |
- | |
840 | PNG_EXPORT 221, void, png_set_expand_16, '(png_structrp png_ptr)' |
- | |
841 | - | ||
842 | ; Expand the grayscale to 24-bit RGB if necessary. |
- | |
843 | PNG_EXPORT 31, void, png_set_gray_to_rgb, '(png_structrp png_ptr)' |
- | |
844 | - | ||
845 | ; Reduce RGB to grayscale. |
810 | ; Reduce RGB to grayscale. |
846 | PNG_ERROR_ACTION_NONE equ 1 |
811 | PNG_ERROR_ACTION_NONE equ 1 |
847 | PNG_ERROR_ACTION_WARN equ 2 |
812 | PNG_ERROR_ACTION_WARN equ 2 |
848 | PNG_ERROR_ACTION_ERROR equ 3 |
813 | PNG_ERROR_ACTION_ERROR equ 3 |
849 | PNG_RGB_TO_GRAY_DEFAULT equ (-1) ;for red/green coefficients |
814 | PNG_RGB_TO_GRAY_DEFAULT equ (-1) ;for red/green coefficients |
Line 850... | Line -... | ||
850 | - | ||
851 | PNG_EXPORT 32, void, png_set_rgb_to_gray, '(png_structrp png_ptr, int error_action, double red, double green)' |
- | |
852 | PNG_EXPORT 33, void, png_set_rgb_to_gray_fixed, '(png_structrp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)' |
- | |
853 | - | ||
854 | PNG_EXPORT 34, byte, png_get_rgb_to_gray_status, '(png_const_structrp png_ptr)' |
- | |
855 | - | ||
856 | PNG_EXPORT 35, void, png_build_grayscale_palette, '(int bit_depth, png_colorp palette)' |
- | |
857 | 815 | ||
858 | ; How the alpha channel is interpreted - this affects how the color channels |
816 | ; How the alpha channel is interpreted - this affects how the color channels |
859 | ; of a PNG file are returned to the calling application when an alpha channel, |
817 | ; of a PNG file are returned to the calling application when an alpha channel, |
Line 860... | Line 818... | ||
860 | ; or a tRNS chunk in a palette file, is present. |
818 | ; or a tRNS chunk in a palette file, is present. |
Line 895... | Line 853... | ||
895 | PNG_ALPHA_PREMULTIPLIED equ 1 ;as above |
853 | PNG_ALPHA_PREMULTIPLIED equ 1 ;as above |
896 | PNG_ALPHA_OPTIMIZED equ 2 ;'PNG' for opaque pixels, else 'STANDARD' |
854 | PNG_ALPHA_OPTIMIZED equ 2 ;'PNG' for opaque pixels, else 'STANDARD' |
897 | PNG_ALPHA_BROKEN equ 3 ;the alpha channel is gamma encoded |
855 | PNG_ALPHA_BROKEN equ 3 ;the alpha channel is gamma encoded |
898 | 856 | ||
Line 899... | Line -... | ||
899 | PNG_EXPORT 227, void, png_set_alpha_mode, '(png_structrp png_ptr, int mode, double output_gamma)' |
- | |
900 | PNG_EXPORT 228, void, png_set_alpha_mode_fixed, '(png_structrp png_ptr, int mode, png_fixed_point output_gamma)' |
- | |
901 | - | ||
902 | if (PNG_GAMMA_SUPPORTED eq 1) | (PNG_READ_ALPHA_MODE_SUPPORTED eq 1) |
857 | if (PNG_GAMMA_SUPPORTED eq 1) | (PNG_READ_ALPHA_MODE_SUPPORTED eq 1) |
903 | ; The output_gamma value is a screen gamma in libpng terminology: it expresses |
858 | ; The output_gamma value is a screen gamma in libpng terminology: it expresses |
904 | ; how to decode the output values, not how they are encoded. |
859 | ; how to decode the output values, not how they are encoded. |
Line 905... | Line 860... | ||
905 | 860 | ||
906 | PNG_DEFAULT_sRGB equ -1 ;sRGB gamma and color space |
861 | PNG_DEFAULT_sRGB equ -1 ;sRGB gamma and color space |
907 | PNG_GAMMA_MAC_18 equ -2 ;Old Mac '1.8' gamma and color space |
862 | PNG_GAMMA_MAC_18 equ -2 ;Old Mac '1.8' gamma and color space |
908 | PNG_GAMMA_sRGB equ 220000 ;Television standards--matches sRGB gamma |
863 | PNG_GAMMA_sRGB equ 220000 ;Television standards--matches sRGB gamma |
909 | PNG_GAMMA_LINEAR equ PNG_FP_1 ;Linear |
864 | PNG_GAMMA_LINEAR equ PNG_FP_1 ;Linear |
Line 910... | Line -... | ||
910 | end if |
- | |
911 | - | ||
912 | ; The following are examples of calls to png_set_alpha_mode to achieve the |
- | |
913 | ; required overall gamma correction and, where necessary, alpha |
- | |
914 | ; premultiplication. |
- | |
915 | - | ||
916 | ; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); |
- | |
917 | ; This is the default libpng handling of the alpha channel - it is not |
- | |
918 | ; pre-multiplied into the color components. In addition the call states |
- | |
919 | ; that the output is for a sRGB system and causes all PNG files without gAMA |
- | |
920 | ; chunks to be assumed to be encoded using sRGB. |
- | |
921 | - | ||
922 | ; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); |
- | |
923 | ; In this case the output is assumed to be something like an sRGB conformant |
- | |
924 | ; display preceeded by a power-law lookup table of power 1.45. This is how |
- | |
925 | ; early Mac systems behaved. |
- | |
926 | - | ||
927 | ; png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR); |
- | |
928 | ; This is the classic Jim Blinn approach and will work in academic |
- | |
929 | ; environments where everything is done by the book. It has the shortcoming |
- | |
930 | ; of assuming that input PNG data with no gamma information is linear - this |
- | |
931 | ; is unlikely to be correct unless the PNG files where generated locally. |
- | |
932 | ; Most of the time the output precision will be so low as to show |
- | |
933 | ; significant banding in dark areas of the image. |
- | |
934 | - | ||
935 | ; png_set_expand_16(pp); |
- | |
936 | ; png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB); |
- | |
937 | ; This is a somewhat more realistic Jim Blinn inspired approach. PNG files |
- | |
938 | ; are assumed to have the sRGB encoding if not marked with a gamma value and |
- | |
939 | ; the output is always 16 bits per component. This permits accurate scaling |
- | |
940 | ; and processing of the data. If you know that your input PNG files were |
- | |
941 | ; generated locally you might need to replace PNG_DEFAULT_sRGB with the |
- | |
942 | ; correct value for your system. |
- | |
943 | - | ||
944 | ; png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB); |
- | |
945 | ; If you just need to composite the PNG image onto an existing background |
- | |
946 | ; and if you control the code that does this you can use the optimization |
- | |
947 | ; setting. In this case you just copy completely opaque pixels to the |
- | |
948 | ; output. For pixels that are not completely transparent (you just skip |
- | |
949 | ; those) you do the composition math using png_composite or png_composite_16 |
- | |
950 | ; below then encode the resultant 8-bit or 16-bit values to match the output |
- | |
951 | ; encoding. |
- | |
952 | - | ||
953 | ; Other cases |
- | |
954 | ; If neither the PNG nor the standard linear encoding work for you because |
- | |
955 | ; of the software or hardware you use then you have a big problem. The PNG |
- | |
956 | ; case will probably result in halos around the image. The linear encoding |
- | |
957 | ; will probably result in a washed out, too bright, image (it's actually too |
- | |
958 | ; contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably |
- | |
959 | ; substantially reduce the halos. Alternatively try: |
- | |
960 | - | ||
961 | ; png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB); |
- | |
962 | ; This option will also reduce the halos, but there will be slight dark |
- | |
963 | ; halos round the opaque parts of the image where the background is light. |
- | |
964 | ; In the OPTIMIZED mode the halos will be light halos where the background |
- | |
965 | ; is dark. Take your pick - the halos are unavoidable unless you can get |
- | |
966 | ; your hardware/software fixed! (The OPTIMIZED approach is slightly |
- | |
967 | ; faster.) |
- | |
968 | - | ||
969 | ; When the default gamma of PNG files doesn't match the output gamma. |
- | |
970 | ; If you have PNG files with no gamma information png_set_alpha_mode allows |
- | |
971 | ; you to provide a default gamma, but it also sets the ouput gamma to the |
- | |
972 | ; matching value. If you know your PNG files have a gamma that doesn't |
- | |
973 | ; match the output you can take advantage of the fact that |
- | |
974 | ; png_set_alpha_mode always sets the output gamma but only sets the PNG |
- | |
975 | ; default if it is not already set: |
- | |
976 | - | ||
977 | ; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); |
- | |
978 | ; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC); |
- | |
979 | ; The first call sets both the default and the output gamma values, the |
- | |
980 | ; second call overrides the output gamma without changing the default. This |
- | |
981 | ; is easier than achieving the same effect with png_set_gamma. You must use |
- | |
982 | ; PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will |
- | |
983 | ; fire if more than one call to png_set_alpha_mode and png_set_background is |
- | |
984 | ; made in the same read operation, however multiple calls with PNG_ALPHA_PNG |
- | |
985 | ; are ignored. |
- | |
986 | - | ||
987 | PNG_EXPORT 36, void, png_set_strip_alpha, '(png_structrp png_ptr)' |
865 | end if |
988 | 866 | ||
989 | ; The values of the PNG_FILLER_ defines should NOT be changed |
867 | ; The values of the PNG_FILLER_ defines should NOT be changed |
Line 990... | Line 868... | ||
990 | PNG_FILLER_BEFORE equ 0 |
868 | PNG_FILLER_BEFORE equ 0 |
Line 996... | Line 874... | ||
996 | ; libpng-1.5.4 this API must not be called before the PNG file header has been |
874 | ; libpng-1.5.4 this API must not be called before the PNG file header has been |
997 | ; read. Doing so will result in unexpected behavior and possible warnings or |
875 | ; read. Doing so will result in unexpected behavior and possible warnings or |
998 | ; errors if the PNG file contains a bKGD chunk. |
876 | ; errors if the PNG file contains a bKGD chunk. |
999 | 877 | ||
Line 1000... | Line -... | ||
1000 | PNG_EXPORT 47, void, png_set_background, '(png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma)' |
- | |
1001 | PNG_EXPORT 215, void, png_set_background_fixed, '(png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, png_fixed_point background_gamma)' |
- | |
1002 | - | ||
1003 | if PNG_READ_BACKGROUND_SUPPORTED eq 1 |
878 | if PNG_READ_BACKGROUND_SUPPORTED eq 1 |
1004 | PNG_BACKGROUND_GAMMA_UNKNOWN equ 0 |
879 | PNG_BACKGROUND_GAMMA_UNKNOWN equ 0 |
1005 | PNG_BACKGROUND_GAMMA_SCREEN equ 1 |
880 | PNG_BACKGROUND_GAMMA_SCREEN equ 1 |
1006 | PNG_BACKGROUND_GAMMA_FILE equ 2 |
881 | PNG_BACKGROUND_GAMMA_FILE equ 2 |
1007 | PNG_BACKGROUND_GAMMA_UNIQUE equ 3 |
882 | PNG_BACKGROUND_GAMMA_UNIQUE equ 3 |
1008 | end if |
883 | end if |
Line 1009... | Line -... | ||
1009 | - | ||
1010 | ; Scale a 16-bit depth file down to 8-bit, accurately. |
- | |
1011 | PNG_EXPORT 229, void, png_set_scale_16, '(png_structrp png_ptr)' |
- | |
1012 | 884 | ||
1013 | ;#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */ |
- | |
1014 | ; Strip the second byte of information from a 16-bit depth file. |
- | |
1015 | PNG_EXPORT 48, void, png_set_strip_16, '(png_structrp png_ptr)' |
- | |
1016 | - | ||
1017 | ; Turn on quantizing, and reduce the palette to the number of colors |
- | |
1018 | ; available. |
- | |
1019 | - | ||
Line 1020... | Line 885... | ||
1020 | PNG_EXPORT 49, void, png_set_quantize, '(png_structrp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_const_uint_16p histogram, int full_quantize)' |
885 | ;PNG_READ_16_TO_8_SUPPORTED equ 1 ;Name prior to 1.5.4 |
1021 | 886 | ||
Line 1022... | Line 887... | ||
1022 | ; The threshold on gamma processing is configurable but hard-wired into the |
887 | ; The threshold on gamma processing is configurable but hard-wired into the |
Line 1023... | Line 888... | ||
1023 | ; library. The following is the floating point variant. |
888 | ; library. The following is the floating point variant. |
1024 | 889 | ||
1025 | ;#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001) |
890 | PNG_GAMMA_THRESHOLD equ (PNG_GAMMA_THRESHOLD_FIXED*.00001) |
1026 | 891 | ||
1027 | ; Handle gamma correction. Screen_gamma=(display_exponent). |
892 | ; Handle gamma correction. Screen_gamma=(display_exponent). |
Line 1028... | Line -... | ||
1028 | ; NOTE: this API simply sets the screen and file gamma values. It will |
- | |
1029 | ; therefore override the value for gamma in a PNG file if it is called after |
- | |
1030 | ; the file header has been read - use with care - call before reading the PNG |
- | |
1031 | ; file for best results! |
- | |
1032 | - | ||
1033 | ; These routines accept the same gamma values as png_set_alpha_mode (described |
- | |
1034 | ; above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either |
- | |
1035 | ; API (floating point or fixed.) Notice, however, that the 'file_gamma' value |
- | |
1036 | ; is the inverse of a 'screen gamma' value. |
- | |
1037 | - | ||
1038 | PNG_EXPORT 50, void, png_set_gamma, '(png_structrp png_ptr, double screen_gamma, double override_file_gamma)' |
- | |
1039 | PNG_EXPORT 208, void, png_set_gamma_fixed, '(png_structrp png_ptr, png_fixed_point screen_gamma, png_fixed_point override_file_gamma)' |
- | |
1040 | - | ||
1041 | ; Optional update palette with requested transformations |
- | |
1042 | PNG_EXPORT 53, void, png_start_read_image, '(png_structrp png_ptr)' |
- | |
1043 | - | ||
1044 | ; Optional call to update the users info structure |
- | |
1045 | PNG_EXPORT 54, void, png_read_update_info, '(png_structrp png_ptr, png_inforp info_ptr)' |
- | |
1046 | - | ||
1047 | ; Read one or more rows of image data. |
- | |
1048 | PNG_EXPORT 55, void, png_read_rows, '(png_structrp png_ptr, bytepp row, bytepp display_row, uint_32 num_rows)' |
- | |
1049 | - | ||
1050 | ; Read a row of data. |
- | |
1051 | PNG_EXPORT 56, void, png_read_row, '(png_structrp png_ptr, bytep row, bytep display_row)' |
- | |
1052 | - | ||
1053 | ; Read the whole image into memory at once. |
- | |
1054 | PNG_EXPORT 57, void, png_read_image, '(png_structrp png_ptr, bytepp image)' |
- | |
1055 | - | ||
1056 | ; Read the end of the PNG file. |
- | |
1057 | PNG_EXPORT 62, void, png_read_end, '(png_structrp png_ptr, png_inforp info_ptr)' |
- | |
1058 | - | ||
Line 1059... | Line 893... | ||
1059 | ; Free any memory associated with the png_struct and the png_info_structs |
893 | ; NOTE: this API simply sets the screen and file gamma values. It will |
1060 | PNG_EXPORT 64, void, png_destroy_read_struct, '(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)' |
894 | ; therefore override the value for gamma in a PNG file if it is called after |
1061 | 895 | ; the file header has been read - use with care - call before reading the PNG |
|
1062 | ; Set the libpng method of handling chunk CRC errors |
896 | ; file for best results! |
Line 1119... | Line 953... | ||
1119 | 953 | ||
1120 | ; Replace the default data input function with a user supplied one. |
954 | ; Replace the default data input function with a user supplied one. |
Line 1121... | Line -... | ||
1121 | PNG_EXPORT 78, void, png_set_read_fn, '(png_structrp png_ptr, voidp io_ptr, png_rw_ptr read_data_fn)' |
- | |
1122 | - | ||
1123 | PNG_EXPORT 80, void, png_set_read_status_fn, '(png_structrp png_ptr, png_read_status_ptr read_row_fn)' |
- | |
1124 | - | ||
1125 | PNG_EXPORT 84, void, png_set_read_user_transform_fn, '(png_structrp png_ptr, png_user_transform_ptr read_user_transform_fn)' |
- | |
1126 | - | ||
1127 | if PNG_PROGRESSIVE_READ_SUPPORTED eq 1 |
- | |
1128 | ; Sets the function callbacks for the push reader, and a pointer to a |
- | |
1129 | ; user-defined structure available to the callback functions. |
- | |
1130 | - | ||
1131 | PNG_EXPORT 90, void, png_set_progressive_read_fn, '(png_structrp png_ptr, voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)' |
- | |
1132 | - | ||
1133 | ; Returns the user pointer associated with the push read functions |
- | |
1134 | PNG_EXPORT 91, voidp, png_get_progressive_ptr, '(png_const_structrp png_ptr)' |
- | |
1135 | - | ||
1136 | ; Function to be called when data becomes available |
- | |
1137 | PNG_EXPORT 92, void, png_process_data, '(png_structrp png_ptr, png_inforp info_ptr, bytep buffer, png_size_t buffer_size)' |
- | |
1138 | - | ||
1139 | ; A function which may be called *only* within png_process_data to stop the |
- | |
1140 | ; processing of any more data. The function returns the number of bytes |
- | |
1141 | ; remaining, excluding any that libpng has cached internally. A subsequent |
- | |
1142 | ; call to png_process_data must supply these bytes again. If the argument |
- | |
1143 | ; 'save' is set to true the routine will first save all the pending data and |
- | |
1144 | ; will always return 0. |
- | |
1145 | - | ||
1146 | PNG_EXPORT 219, png_size_t, png_process_data_pause, '(png_structrp, int save)' |
- | |
1147 | - | ||
1148 | ; A function which may be called *only* outside (after) a call to |
- | |
1149 | ; png_process_data. It returns the number of bytes of data to skip in the |
- | |
1150 | ; input. Normally it will return 0, but if it returns a non-zero value the |
- | |
1151 | ; application must skip than number of bytes of input data and pass the |
- | |
1152 | ; following data to the next call to png_process_data. |
- | |
1153 | - | ||
1154 | PNG_EXPORT 220, uint_32, png_process_data_skip, '(png_structrp)' |
- | |
1155 | - | ||
1156 | ; Function that combines rows. 'new_row' is a flag that should come from |
- | |
1157 | ; the callback and be non-NULL if anything needs to be done; the library |
- | |
1158 | ; stores its own version of the new data internally and ignores the passed |
- | |
1159 | ; in value. |
- | |
1160 | - | ||
Line 1161... | Line 955... | ||
1161 | PNG_EXPORT 93, void, png_progressive_combine_row, '(png_const_structrp png_ptr, bytep old_row, bytep new_row)' |
955 | PNG_EXPORT 78, void, png_set_read_fn, '(png_structrp png_ptr, voidp io_ptr, png_rw_ptr read_data_fn)' |
1162 | end if ;PROGRESSIVE_READ |
956 | |
1163 | 957 | ||
Line 1226... | Line 1020... | ||
1226 | ;# define png_chunk_benign_error png_chunk_error |
1020 | ;# define png_chunk_benign_error png_chunk_error |
1227 | ;# endif |
1021 | ;# endif |
1228 | ;end if |
1022 | ;end if |
1229 | 1023 | ||
Line 1230... | Line -... | ||
1230 | ; Returns number of color channels in image. |
- | |
1231 | PNG_EXPORT 114, byte, png_get_channels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1232 | - | ||
1233 | ; Returns pixel aspect ratio, computed from pHYs chunk data. |
- | |
1234 | PNG_EXPORT 125, float, png_get_pixel_aspect_ratio, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1235 | PNG_EXPORT 210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1236 | - | ||
1237 | ; Returns image x, y offset in pixels or microns, from oFFs chunk data. |
- | |
1238 | PNG_EXPORT 126, int_32, png_get_x_offset_pixels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1239 | PNG_EXPORT 127, int_32, png_get_y_offset_pixels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1240 | PNG_EXPORT 128, int_32, png_get_x_offset_microns, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1241 | PNG_EXPORT 129, int_32, png_get_y_offset_microns, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1242 | - | ||
1243 | ; Returns pointer to signature string read from PNG header |
- | |
1244 | PNG_EXPORT 130, bytep, png_get_signature, '(png_const_structrp png_ptr, png_const_inforp info_ptr)' |
- | |
1245 | - | ||
1246 | PNG_EXPORT 131, uint_32, png_get_bKGD, '(png_const_structrp png_ptr, png_inforp info_ptr, png_color_16p *background)' |
- | |
1247 | - | ||
1248 | PNG_EXPORT 133, uint_32, png_get_cHRM, '(png_const_structrp png_ptr, png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y)' |
- | |
1249 | PNG_EXPORT 230, uint_32, png_get_cHRM_XYZ, '(png_const_structrp png_ptr, png_const_inforp 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)' |
- | |
1250 | PNG_EXPORT 134, uint_32, png_get_cHRM_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)' |
- | |
1251 | - | ||
1252 | PNG_EXPORT 137, uint_32, png_get_gAMA, '(png_const_structrp png_ptr, png_const_inforp info_ptr, double *file_gamma)' |
- | |
1253 | PNG_EXPORT 138, uint_32, png_get_gAMA_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_file_gamma)' |
- | |
1254 | - | ||
1255 | PNG_EXPORT 145, uint_32, png_get_oFFs, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int_32 *offset_x, int_32 *offset_y, int *unit_type)' |
- | |
1256 | - | ||
1257 | PNG_EXPORT 147, uint_32, png_get_pCAL, '(png_const_structrp png_ptr, png_inforp info_ptr, charp *purpose, int_32 *X0, int_32 *X1, int *type, int *nparams, charp *units, charpp *params)' |
- | |
1258 | - | ||
1259 | PNG_EXPORT 149, uint_32, png_get_pHYs, '(png_const_structrp png_ptr, png_const_inforp info_ptr, uint_32 *res_x, uint_32 *res_y, int *unit_type)' |
- | |
1260 | - | ||
1261 | PNG_EXPORT 151, uint_32, png_get_PLTE, '(png_const_structrp png_ptr, png_inforp info_ptr, png_colorp *palette, int *num_palette)' |
- | |
1262 | - | ||
1263 | PNG_EXPORT 153, uint_32, png_get_sBIT, '(png_const_structrp png_ptr, png_inforp info_ptr, png_color_8p *sig_bit)' |
- | |
1264 | - | ||
1265 | PNG_EXPORT 155, uint_32, png_get_sRGB, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *file_srgb_intent)' |
- | |
1266 | - | ||
1267 | ; png_get_text also returns the number of text chunks in *num_text |
- | |
1268 | PNG_EXPORT 162, int, png_get_text, '(png_const_structrp png_ptr, png_inforp info_ptr, png_textp *text_ptr, int *num_text)' |
- | |
1269 | - | ||
1270 | PNG_EXPORT 164, uint_32, png_get_tIME, '(png_const_structrp png_ptr, png_inforp info_ptr, png_timep *mod_time)' |
- | |
1271 | - | ||
1272 | PNG_EXPORT 166, uint_32, png_get_tRNS, '(png_const_structrp png_ptr, png_inforp info_ptr, bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)' |
- | |
1273 | - | ||
1274 | PNG_EXPORT 168, uint_32, png_get_sCAL, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, double *width, double *height)' |
- | |
1275 | - | ||
1276 | ; NOTE: this API is currently implemented using floating point arithmetic, |
- | |
1277 | ; consequently it can only be used on systems with floating point support. |
- | |
1278 | ; In any case the range of values supported by png_fixed_point is small and it |
- | |
1279 | ; is highly recommended that png_get_sCAL_s be used instead. |
- | |
1280 | - | ||
1281 | PNG_EXPORT 214, uint_32, png_get_sCAL_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height)' |
- | |
1282 | - | ||
1283 | PNG_EXPORT 170, void, png_set_sCAL, '(png_const_structrp png_ptr, png_inforp info_ptr, int unit, double width, double height)' |
- | |
1284 | PNG_EXPORT 171, void, png_set_sCAL_s, '(png_const_structrp png_ptr, png_inforp info_ptr, int unit, charp swidth, charp sheight)' |
- | |
Line 1285... | Line 1024... | ||
1285 | 1024 | ||
1286 | ; Provide the default handling for all unknown chunks or, optionally, for |
1025 | ; Provide the default handling for all unknown chunks or, optionally, for |
Line 1287... | Line 1026... | ||
1287 | ; specific unknown chunks. |
1026 | ; specific unknown chunks. |
Line 1381... | Line 1120... | ||
1381 | ; except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to |
1120 | ; except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to |
1382 | ; be processed by libpng. |
1121 | ; be processed by libpng. |
1383 | 1122 | ||
Line 1384... | Line -... | ||
1384 | - | ||
1385 | ; The "params" pointer is currently not used and is for future expansion. |
- | |
1386 | PNG_EXPORT 178, void, png_read_png, '(png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params)' |
- | |
1387 | 1123 | ||
1388 | ; For use in png_set_keep_unknown, added to version 1.2.6 |
1124 | ; For use in png_set_keep_unknown, added to version 1.2.6 |
1389 | PNG_HANDLE_CHUNK_AS_DEFAULT equ 0 |
1125 | PNG_HANDLE_CHUNK_AS_DEFAULT equ 0 |
1390 | PNG_HANDLE_CHUNK_NEVER equ 1 |
1126 | PNG_HANDLE_CHUNK_NEVER equ 1 |
1391 | PNG_HANDLE_CHUNK_IF_SAFE equ 2 |
1127 | PNG_HANDLE_CHUNK_IF_SAFE equ 2 |
Line 1411... | Line 1147... | ||
1411 | ; Interlace support. The following macros are always defined so that if |
1147 | ; Interlace support. The following macros are always defined so that if |
1412 | ; libpng interlace handling is turned off the macros may be used to handle |
1148 | ; libpng interlace handling is turned off the macros may be used to handle |
1413 | ; interlaced images within the application. |
1149 | ; interlaced images within the application. |
Line 1414... | Line 1150... | ||
1414 | 1150 | ||
Line 1415... | Line 1151... | ||
1415 | ;#define PNG_INTERLACE_ADAM7_PASSES 7 |
1151 | PNG_INTERLACE_ADAM7_PASSES equ 7 |
1416 | 1152 | ||
1417 | ; Two macros to return the first row and first column of the original, |
1153 | ; Two macros to return the first row and first column of the original, |
Line 1418... | Line 1154... | ||
1418 | ; full, image which appears in a given pass. 'pass' is in the range 0 |
1154 | ; full, image which appears in a given pass. 'pass' is in the range 0 |
1419 | ; to 6 and the result is in the range 0 to 7. |
1155 | ; to 6 and the result is in the range 0 to 7. |
1420 | 1156 | ||
1421 | macro PNG_PASS_START_ROW pass |
1157 | macro PNG_PASS_START_ROW pass |
- | 1158 | { |
|
1422 | { |
1159 | push ebx ecx |
1423 | push ebx ecx |
- | |
1424 | mov eax,pass |
1160 | mov eax,pass |
1425 | not eax |
1161 | mov ebx,eax |
1426 | mov ebx,pass |
1162 | not eax |
1427 | and eax,1 |
1163 | and eax,1 |
1428 | shr ebx,1 |
1164 | shr ebx,1 |
Line 1435... | Line 1171... | ||
1435 | macro PNG_PASS_START_COL pass |
1171 | macro PNG_PASS_START_COL pass |
1436 | { |
1172 | { |
1437 | push ebx ecx |
1173 | push ebx ecx |
1438 | mov eax,pass |
1174 | mov eax,pass |
1439 | mov ebx,pass |
1175 | mov ebx,eax |
1440 | and eax,1 |
1176 | and eax,1 |
1441 | inc ebx |
1177 | inc ebx |
1442 | shr ebx,1 |
1178 | shr ebx,1 |
1443 | mov ecx,3 |
1179 | mov ecx,3 |
1444 | sub ecx,ebx |
1180 | sub ecx,ebx |
1445 | shl eax,cl |
1181 | shl eax,cl |
Line 1595... | Line 1331... | ||
1595 | ; (uint_32)(bg)*(uint_32)(65535 - (uint_32)(alpha)) + \ |
1331 | ; (uint_32)(bg)*(uint_32)(65535 - (uint_32)(alpha)) + \ |
1596 | ; 32767) / 65535)) |
1332 | ; 32767) / 65535)) |
1597 | ;end if /* READ_COMPOSITE_NODIV */ |
1333 | ;end if /* READ_COMPOSITE_NODIV */ |
1598 | 1334 | ||
Line 1599... | Line -... | ||
1599 | PNG_EXPORT 201, uint_32, png_get_uint_32, '(bytep buf)' |
- | |
1600 | PNG_EXPORT 202, uint_16, png_get_uint_16, '(bytep buf)' |
- | |
1601 | PNG_EXPORT 203, int_32, png_get_int_32, '(bytep buf)' |
- | |
1602 | - | ||
1603 | PNG_EXPORT 204, uint_32, png_get_uint_31, '(png_const_structrp png_ptr, bytep buf)' |
- | |
1604 | ; No png_get_int_16 -- may be added if there's a real need for it. |
- | |
1605 | - | ||
1606 | ;if PNG_USE_READ_MACROS |
1335 | if PNG_USE_READ_MACROS eq 1 |
1607 | ; Inline macros to do direct reads of bytes from the input buffer. |
1336 | ; Inline macros to do direct reads of bytes from the input buffer. |
1608 | ; The png_get_int_32() routine assumes we are using two's complement |
1337 | ; The png_get_int_32() routine assumes we are using two's complement |
1609 | ; format for negative values, which is almost certainly true. |
1338 | ; format for negative values, which is almost certainly true. |
Line 1610... | Line 1339... | ||
1610 | 1339 | ||
Line 1625... | Line 1354... | ||
1625 | ;# define PNG_get_int_32(buf) \ |
1354 | ;# define PNG_get_int_32(buf) \ |
1626 | ; ((int_32)((*(buf) & 0x80) \ |
1355 | ; ((int_32)((*(buf) & 0x80) \ |
1627 | ; ? -((int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \ |
1356 | ; ? -((int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \ |
1628 | ; : (int_32)png_get_uint_32(buf))) |
1357 | ; : (int_32)png_get_uint_32(buf))) |
1629 | - | ||
1630 | ; If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h, |
- | |
1631 | ; but defining a macro name prefixed with PNG_PREFIX. |
- | |
1632 | - | ||
1633 | ;# ifndef PNG_PREFIX |
- | |
1634 | ;# define png_get_uint_32(buf) PNG_get_uint_32(buf) |
- | |
1635 | ;# define png_get_uint_16(buf) PNG_get_uint_16(buf) |
- | |
1636 | ;# define png_get_int_32(buf) PNG_get_int_32(buf) |
- | |
1637 | ;# endif |
- | |
1638 | ;#else |
- | |
1639 | ;# ifdef PNG_PREFIX |
- | |
1640 | ; No macros; revert to the (redefined) function |
- | |
1641 | ;# define PNG_get_uint_32 (png_get_uint_32) |
- | |
1642 | ;# define PNG_get_uint_16 (png_get_uint_16) |
- | |
1643 | ;# define PNG_get_int_32 (png_get_int_32) |
- | |
1644 | ;# endif |
- | |
1645 | ;end if |
1358 | end if |
Line 1646... | Line 1359... | ||
1646 | 1359 | ||
1647 | ;/******************************************************************************* |
1360 | ;/******************************************************************************* |
1648 | ; Section 5: SIMPLIFIED API |
1361 | ; Section 5: SIMPLIFIED API |
Line 1802... | Line 1515... | ||
1802 | PNG_FORMAT_FLAG_COLOR equ 0x02 ;color format: otherwise grayscale |
1515 | PNG_FORMAT_FLAG_COLOR equ 0x02 ;color format: otherwise grayscale |
1803 | PNG_FORMAT_FLAG_LINEAR equ 0x04 ;2-byte channels else 1-byte |
1516 | PNG_FORMAT_FLAG_LINEAR equ 0x04 ;2-byte channels else 1-byte |
1804 | PNG_FORMAT_FLAG_COLORMAP equ 0x08 ;image data is color-mapped |
1517 | PNG_FORMAT_FLAG_COLORMAP equ 0x08 ;image data is color-mapped |
1805 | 1518 | ||
Line 1806... | Line -... | ||
1806 | ;if PNG_FORMAT_BGR_SUPPORTED |
- | |
1807 | PNG_FORMAT_FLAG_BGR equ 0x10 ;BGR colors, else order is RGB |
1519 | PNG_FORMAT_FLAG_BGR equ 0x10 ;BGR colors, else order is RGB |
1808 | ;end if |
- | |
Line 1809... | Line -... | ||
1809 | - | ||
1810 | ;if PNG_FORMAT_AFIRST_SUPPORTED |
1520 | |
1811 | PNG_FORMAT_FLAG_AFIRST equ 0x20 ;alpha channel comes first |
- | |
Line 1812... | Line 1521... | ||
1812 | ;end if |
1521 | PNG_FORMAT_FLAG_AFIRST equ 0x20 ;alpha channel comes first |
Line 1813... | Line 1522... | ||
1813 | 1522 | ||
Line 2005... | Line 1714... | ||
2005 | 1714 | ||
Line 2006... | Line 1715... | ||
2006 | ; NOTE: the flag can only be set after the png_image_begin_read_ call, |
1715 | ; NOTE: the flag can only be set after the png_image_begin_read_ call, |
2007 | ; because that call initializes the 'flags' field. |
1716 | ; because that call initializes the 'flags' field. |
Line 2008... | Line -... | ||
2008 | - | ||
2009 | - | ||
2010 | ;if PNG_SIMPLIFIED_READ_SUPPORTED |
- | |
2011 | ; READ APIs |
- | |
2012 | ; --------- |
- | |
2013 | - | ||
2014 | ; The png_image passed to the read APIs must have been initialized by setting |
- | |
2015 | ; the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.) |
- | |
2016 | - | ||
2017 | if PNG_STDIO_SUPPORTED eq 1 |
- | |
2018 | PNG_EXPORT 234, int, png_image_begin_read_from_file, '(png_imagep image, const char *file_name)' |
- | |
2019 | ; The named file is opened for read and the image header is filled in |
- | |
2020 | ; from the PNG header in the file. |
- | |
2021 | - | ||
2022 | PNG_EXPORT 235, int, png_image_begin_read_from_stdio, '(png_imagep image, FILE* file)' |
- | |
2023 | ; The PNG header is read from the stdio FILE object. |
- | |
2024 | end if ;STDIO |
- | |
2025 | - | ||
2026 | PNG_EXPORT 236, int, png_image_begin_read_from_memory, '(png_imagep image, png_const_voidp memory, png_size_t size)' |
- | |
2027 | ; The PNG header is read from the given memory buffer. |
- | |
2028 | - | ||
2029 | PNG_EXPORT 237, int, png_image_finish_read, '(png_imagep image, png_const_colorp background, void *buffer, int_32 row_stride, void *colormap)' |
- | |
2030 | ; Finish reading the image into the supplied buffer and clean up the |
- | |
2031 | ; png_image structure. |
- | |
2032 | - | ||
2033 | ; row_stride is the step, in byte or 2-byte units as appropriate, |
- | |
2034 | ; between adjacent rows. A positive stride indicates that the top-most row |
- | |
2035 | ; is first in the buffer - the normal top-down arrangement. A negative |
- | |
2036 | ; stride indicates that the bottom-most row is first in the buffer. |
- | |
2037 | - | ||
2038 | ; background need only be supplied if an alpha channel must be removed from |
- | |
2039 | ; a byte format and the removal is to be done by compositing on a solid |
- | |
2040 | ; color; otherwise it may be NULL and any composition will be done directly |
- | |
2041 | ; onto the buffer. The value is an sRGB color to use for the background, |
- | |
2042 | ; for grayscale output the green channel is used. |
- | |
2043 | - | ||
2044 | ; background must be supplied when an alpha channel must be removed from a |
- | |
2045 | ; single byte color-mapped output format, in other words if: |
- | |
2046 | - | ||
2047 | ; 1) The original format from png_image_begin_read_from_* had |
- | |
2048 | ; PNG_FORMAT_FLAG_ALPHA set. |
- | |
2049 | ; 2) The format set by the application does not. |
- | |
2050 | ; 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and |
- | |
2051 | ; PNG_FORMAT_FLAG_LINEAR *not* set. |
- | |
2052 | - | ||
2053 | ; For linear output removing the alpha channel is always done by compositing |
- | |
2054 | ; on black and background is ignored. |
- | |
2055 | - | ||
2056 | ; colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must |
- | |
2057 | ; be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE. |
- | |
2058 | ; image->colormap_entries will be updated to the actual number of entries |
- | |
2059 | ; written to the colormap; this may be less than the original value. |
- | |
2060 | - | ||
2061 | - | ||
2062 | ;end if /* SIMPLIFIED_READ */ |
- | |
2063 | 1717 | ||
2064 | ;if PNG_SIMPLIFIED_WRITE_SUPPORTED |
1718 | if PNG_SIMPLIFIED_WRITE_SUPPORTED eq 1 |
2065 | ;/* WRITE APIS |
1719 | ; WRITE APIS |
2066 | ; ---------- |
1720 | ; ---------- |
2067 | ; For write you must initialize a png_image structure to describe the image to |
1721 | ; For write you must initialize a png_image structure to describe the image to |
2068 | ; be written. To do this use memset to set the whole structure to 0 then |
1722 | ; be written. To do this use memset to set the whole structure to 0 then |
Line 2138... | Line 1792... | ||
2138 | ;end if |
1792 | ;end if |
Line 2139... | Line 1793... | ||
2139 | 1793 | ||
2140 | ;#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\ |
1794 | ;#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\ |
2141 | ; PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image)) |
1795 | ; PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image)) |
2142 | ; /* An upper bound on the size of the data in the PNG IDAT chunks. */ |
1796 | ; An upper bound on the size of the data in the PNG IDAT chunks. |
2143 | ; |
1797 | |
2144 | ;#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\ |
1798 | ;#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\ |
2145 | ; ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\ |
1799 | ; ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\ |
2146 | ; (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\ |
1800 | ; (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\ |
2147 | ; 12U+3U*(image).colormap_entries/*PLTE data*/+\ |
1801 | ; 12U+3U*(image).colormap_entries/*PLTE data*/+\ |
2148 | ; (((image).format&PNG_FORMAT_FLAG_ALPHA)?\ |
1802 | ; (((image).format&PNG_FORMAT_FLAG_ALPHA)?\ |
2149 | ; 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\ |
1803 | ; 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\ |
- | 1804 | ; 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size)) |
|
2150 | ; 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size)) |
1805 | |
2151 | ; /* A helper for the following macro; if your compiler cannot handle the |
1806 | ; A helper for the following macro; if your compiler cannot handle the |
2152 | ; following macro use this one with the result of |
1807 | ; following macro use this one with the result of |
2153 | ; PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most |
1808 | ; PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most |
Line 2154... | Line -... | ||
2154 | ; compilers should handle this just fine.) |
- | |
2155 | 1809 | ; compilers should handle this just fine.) |
|
2156 | 1810 | ||
2157 | ;#define PNG_IMAGE_PNG_SIZE_MAX(image)\ |
1811 | ;#define PNG_IMAGE_PNG_SIZE_MAX(image)\ |
2158 | ; PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image)) |
1812 | ; PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image)) |
2159 | ; An upper bound on the total length of the PNG data stream for 'image'. |
1813 | ; An upper bound on the total length of the PNG data stream for 'image'. |
2160 | ; The result is of type png_alloc_size_t, on 32-bit systems this may |
1814 | ; The result is of type png_alloc_size_t, on 32-bit systems this may |
Line 2161... | Line 1815... | ||
2161 | ; overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will |
1815 | ; overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will |
2162 | ; run out of buffer space but return a corrected size which should work. |
1816 | ; run out of buffer space but return a corrected size which should work. |
2163 | 1817 | ||
2164 | ;end if /* SIMPLIFIED_WRITE */ |
1818 | end if ;SIMPLIFIED_WRITE |
2165 | ;/******************************************************************************* |
1819 | ;/******************************************************************************* |