Subversion Repositories Kolibri OS

Rev

Rev 2388 | Rev 3036 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;================================================================================================;;
  2. ;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ////////////////////////////////;;
  3. ;;================================================================================================;;
  4. ;;                                                                                                ;;
  5. ;; This file is part of Common development libraries (Libs-Dev).                                  ;;
  6. ;;                                                                                                ;;
  7. ;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
  8. ;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
  9. ;; of the License, or (at your option) any later version.                                         ;;
  10. ;;                                                                                                ;;
  11. ;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
  12. ;; even the implied warranty of 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 License along with Libs-Dev.  ;;
  16. ;; If not, see <http://www.gnu.org/licenses/>.                                                    ;;
  17. ;;                                                                                                ;;
  18. ;;================================================================================================;;
  19.  
  20. ; list of format id's
  21. LIBIMG_FORMAT_ID_BMP    = 1
  22. LIBIMG_FORMAT_ID_ICO    = 2
  23. LIBIMG_FORMAT_ID_CUR    = 3
  24. LIBIMG_FORMAT_ID_GIF    = 4
  25. LIBIMG_FORMAT_ID_PNG    = 5
  26. LIBIMG_FORMAT_ID_JPEG   = 6
  27. LIBIMG_FORMAT_ID_TGA    = 7
  28. LIBIMG_FORMAT_ID_PCX    = 8
  29. LIBIMG_FORMAT_ID_XCF    = 9
  30. LIBIMG_FORMAT_ID_TIFF   = 10
  31. LIBIMG_FORMAT_ID_PNM    = 11
  32. LIBIMG_FORMAT_ID_WBMP   = 12
  33. LIBIMG_FORMAT_ID_Z80    = 13
  34.  
  35. ; error codes
  36. LIBIMG_ERROR_OUT_OF_MEMORY = 1
  37. LIBIMG_ERROR_FORMAT        = 2
  38. LIBIMG_ERROR_CONDITIONS    = 3
  39. LIBIMG_ERROR_BIT_DEPTH     = 4
  40. LIBIMG_ERROR_ENCODER       = 5
  41.  
  42. ; encode flags (byte 0x02 of _common option)
  43. LIBIMG_ENCODE_STRICT_SPECIFIC  = 0x01
  44. LIBIMG_ENCODE_STRICT_BIT_DEPTH = 0x02
  45. LIBIMG_ENCODE_DELETE_ALPHA     = 0x08
  46. LIBIMG_ENCODE_FLUSH_ALPHA      = 0x10
  47.  
  48. struct FormatsTableEntry
  49.   Format_id     dd ?
  50.   Is            dd ?
  51.   Decode        dd ?
  52.   Encode        dd ?
  53.   Capabilities  dd ?
  54. ends
  55.  
  56. struct Image
  57.   Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0]
  58.   Width    dd ?
  59.   Height   dd ?
  60.   Next     dd ?
  61.   Previous dd ?
  62.   Type     dd ? ; one of Image.bppN
  63.   Data     dd ?
  64.   Palette  dd ? ; used iff Type eq Image.bpp8 or Image.bpp1
  65.   Extended dd ?
  66.   Flags    dd ? ; bitfield
  67.   Delay    dd ? ; used iff Image.IsAnimated is set in Flags
  68. ends
  69.  
  70. ; values for Image.Type
  71. ; must be consecutive to allow fast switch on Image.Type in support functions
  72. Image.bpp8  = 1
  73. Image.bpp24 = 2
  74. Image.bpp32 = 3
  75. Image.bpp15 = 4
  76. Image.bpp16 = 5
  77. Image.bpp1  = 6
  78. Image.bpp4  = 7
  79.  
  80. ; bits in Image.Flags
  81. Image.IsAnimated = 1
  82.  
  83. struct ImageDecodeOptions
  84.   UsedSize        dd ? ; if >=8, the field BackgroundColor is valid, and so on
  85.   BackgroundColor dd ? ; used for transparent images as background
  86. ends
  87.  
  88. FLIP_VERTICAL   = 0x01
  89. FLIP_HORIZONTAL = 0x02
  90. FLIP_BOTH   = FLIP_VERTICAL or FLIP_HORIZONTAL
  91.  
  92. ROTATE_90_CW   = 0x01
  93. ROTATE_180     = 0x02
  94. ROTATE_270_CW  = 0x03
  95. ROTATE_90_CCW  = ROTATE_270_CW
  96. ROTATE_270_CCW = ROTATE_90_CW
  97.