Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
4.1 KiB

  1. /*---------------------------------------------------------------------------
  2. wpng - simple PNG-writing program writepng.h
  3. ---------------------------------------------------------------------------
  4. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
  5. This software is provided "as is," without warranty of any kind,
  6. express or implied. In no event shall the author or contributors
  7. be held liable for any damages arising in any way from the use of
  8. this software.
  9. The contents of this file are DUAL-LICENSED. You may modify and/or
  10. redistribute this software according to the terms of one of the
  11. following two licenses (at your option):
  12. LICENSE 1 ("BSD-like with advertising clause"):
  13. Permission is granted to anyone to use this software for any purpose,
  14. including commercial applications, and to alter it and redistribute
  15. it freely, subject to the following restrictions:
  16. 1. Redistributions of source code must retain the above copyright
  17. notice, disclaimer, and this list of conditions.
  18. 2. Redistributions in binary form must reproduce the above copyright
  19. notice, disclaimer, and this list of conditions in the documenta-
  20. tion and/or other materials provided with the distribution.
  21. 3. All advertising materials mentioning features or use of this
  22. software must display the following acknowledgment:
  23. This product includes software developed by Greg Roelofs
  24. and contributors for the book, "PNG: The Definitive Guide,"
  25. published by O'Reilly and Associates.
  26. LICENSE 2 (GNU GPL v2 or later):
  27. This program is free software; you can redistribute it and/or modify
  28. it under the terms of the GNU General Public License as published by
  29. the Free Software Foundation; either version 2 of the License, or
  30. (at your option) any later version.
  31. This program is distributed in the hope that it will be useful,
  32. but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. GNU General Public License for more details.
  35. You should have received a copy of the GNU General Public License
  36. along with this program; if not, write to the Free Software Foundation,
  37. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  38. ---------------------------------------------------------------------------*/
  39. #ifndef TRUE
  40. # define TRUE 1
  41. # define FALSE 0
  42. #endif
  43. #ifndef MAX
  44. # define MAX(a,b) ((a) > (b)? (a) : (b))
  45. # define MIN(a,b) ((a) < (b)? (a) : (b))
  46. #endif
  47. #ifdef DEBUG
  48. # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
  49. #else
  50. # define Trace(x) ;
  51. #endif
  52. #define TEXT_TITLE 0x01
  53. #define TEXT_AUTHOR 0x02
  54. #define TEXT_DESC 0x04
  55. #define TEXT_COPY 0x08
  56. #define TEXT_EMAIL 0x10
  57. #define TEXT_URL 0x20
  58. #define TEXT_TITLE_OFFSET 0
  59. #define TEXT_AUTHOR_OFFSET 72
  60. #define TEXT_COPY_OFFSET (2*72)
  61. #define TEXT_EMAIL_OFFSET (3*72)
  62. #define TEXT_URL_OFFSET (4*72)
  63. #define TEXT_DESC_OFFSET (5*72)
  64. typedef unsigned char uch;
  65. typedef unsigned short ush;
  66. typedef unsigned long ulg;
  67. typedef struct _mainprog_info {
  68. double gamma;
  69. long width;
  70. long height;
  71. time_t modtime;
  72. FILE *infile;
  73. FILE *outfile;
  74. void *png_ptr;
  75. void *info_ptr;
  76. uch *image_data;
  77. uch **row_pointers;
  78. char *title;
  79. char *author;
  80. char *desc;
  81. char *copyright;
  82. char *email;
  83. char *url;
  84. int filter; /* command-line-filter flag, not PNG row filter! */
  85. int pnmtype;
  86. int sample_depth;
  87. int interlaced;
  88. int have_bg;
  89. int have_time;
  90. int have_text;
  91. jmp_buf jmpbuf;
  92. uch bg_red;
  93. uch bg_green;
  94. uch bg_blue;
  95. } mainprog_info;
  96. /* prototypes for public functions in writepng.c */
  97. void writepng_version_info(void);
  98. int writepng_init(mainprog_info *mainprog_ptr);
  99. int writepng_encode_image(mainprog_info *mainprog_ptr);
  100. int writepng_encode_row(mainprog_info *mainprog_ptr);
  101. int writepng_encode_finish(mainprog_info *mainprog_ptr);
  102. void writepng_cleanup(mainprog_info *mainprog_ptr);