diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-03-19 06:19:40 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-03-19 18:16:05 -0500 |
commit | 5a13159bfcd42c0092472150c4d22589dea7931e (patch) | |
tree | 71a65f63b8e9a64e001b4fd4d83aed539eb19e57 /example.c | |
parent | ae1b45a04699235546b4d725aa4eceec138ffacd (diff) | |
download | libpng-5a13159bfcd42c0092472150c4d22589dea7931e.tar.gz |
[master] Imported from libpng-1.5.10rc01.tar
Diffstat (limited to 'example.c')
-rw-r--r-- | example.c | 55 |
1 files changed, 34 insertions, 21 deletions
@@ -2,8 +2,8 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.5.7 [December 15, 2011] - * Maintained 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.10 [(PENDING RELEASE)] + * Maintained 1998-2012 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc. */ @@ -695,25 +695,38 @@ void write_png(char *file_name /* , ... other image information ... */) png_set_gAMA(png_ptr, info_ptr, gamma); /* Optionally write comments into the image */ - text_ptr[0].key = "Title"; - text_ptr[0].text = "Mona Lisa"; - text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr[0].itxt_length = 0; - text_ptr[0].lang = NULL; - text_ptr[0].lang_key = NULL; - text_ptr[1].key = "Author"; - text_ptr[1].text = "Leonardo DaVinci"; - text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr[1].itxt_length = 0; - text_ptr[1].lang = NULL; - text_ptr[1].lang_key = NULL; - text_ptr[2].key = "Description"; - text_ptr[2].text = "<long text>"; - text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; - text_ptr[2].itxt_length = 0; - text_ptr[2].lang = NULL; - text_ptr[2].lang_key = NULL; - png_set_text(png_ptr, info_ptr, text_ptr, 3); + { + png_text text_ptr[3]; + + char key0[]="Title"; + char text0[]="Mona Lisa"; + text_ptr[0].key = key0; + text_ptr[0].text = text0; + text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[0].itxt_length = 0; + text_ptr[0].lang = NULL; + text_ptr[0].lang_key = NULL; + + char key1[]="Author"; + char text1[]="Leonardo DaVinci"; + text_ptr[1].key = key1; + text_ptr[1].text = text1; + text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[1].itxt_length = 0; + text_ptr[1].lang = NULL; + text_ptr[1].lang_key = NULL; + + char key2[]="Description"; + char text2[]="<long text>"; + text_ptr[2].key = key2; + text_ptr[2].text = text2; + text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; + text_ptr[2].itxt_length = 0; + text_ptr[2].lang = NULL; + text_ptr[2].lang_key = NULL; + + png_set_text(write_ptr, write_info_ptr, text_ptr, 3); + } /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ |