2008-02-07 23:45:15 +01:00
|
|
|
;;================================================================================================;;
|
2013-05-11 23:31:21 +02:00
|
|
|
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2013 ///////;;
|
2008-02-07 23:45:15 +01:00
|
|
|
;;================================================================================================;;
|
|
|
|
;; ;;
|
|
|
|
;; This file is part of Common development libraries (Libs-Dev). ;;
|
|
|
|
;; ;;
|
|
|
|
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
|
2009-01-25 19:12:30 +01:00
|
|
|
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
|
|
|
|
;; of the License, or (at your option) any later version. ;;
|
2008-02-07 23:45:15 +01:00
|
|
|
;; ;;
|
|
|
|
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
|
|
|
|
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
|
2009-01-25 19:12:30 +01:00
|
|
|
;; Lesser General Public License for more details. ;;
|
2008-02-07 23:45:15 +01:00
|
|
|
;; ;;
|
2009-01-25 19:12:30 +01:00
|
|
|
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;;
|
|
|
|
;; If not, see <http://www.gnu.org/licenses/>. ;;
|
2008-02-07 23:45:15 +01:00
|
|
|
;; ;;
|
|
|
|
;;================================================================================================;;
|
|
|
|
|
2012-05-26 01:02:44 +02:00
|
|
|
; list of format id's
|
2012-11-17 14:24:10 +01:00
|
|
|
LIBIMG_FORMAT_BMP = 1
|
|
|
|
LIBIMG_FORMAT_ICO = 2
|
|
|
|
LIBIMG_FORMAT_CUR = 3
|
|
|
|
LIBIMG_FORMAT_GIF = 4
|
|
|
|
LIBIMG_FORMAT_PNG = 5
|
|
|
|
LIBIMG_FORMAT_JPEG = 6
|
|
|
|
LIBIMG_FORMAT_TGA = 7
|
|
|
|
LIBIMG_FORMAT_PCX = 8
|
|
|
|
LIBIMG_FORMAT_XCF = 9
|
|
|
|
LIBIMG_FORMAT_TIFF = 10
|
|
|
|
LIBIMG_FORMAT_PNM = 11
|
|
|
|
LIBIMG_FORMAT_WBMP = 12
|
2013-05-10 14:28:39 +02:00
|
|
|
LIBIMG_FORMAT_XBM = 13
|
|
|
|
LIBIMG_FORMAT_Z80 = 14
|
2012-05-26 01:02:44 +02:00
|
|
|
|
2012-11-17 14:24:10 +01:00
|
|
|
; scale type ; corresponding img.scale params
|
|
|
|
LIBIMG_SCALE_INTEGER = 1 ; scale factor ; reserved 0
|
|
|
|
LIBIMG_SCALE_TILE = 2 ; new width ; new height
|
|
|
|
LIBIMG_SCALE_STRETCH = 3 ; new width ; new height
|
|
|
|
LIBIMG_SCALE_FIT_RECT = 4 ; new width ; new height
|
|
|
|
LIBIMG_SCALE_FIT_WIDTH = 5 ; new width ; new height
|
|
|
|
LIBIMG_SCALE_FIT_HEIGHT = 6 ; new width ; new height
|
|
|
|
LIBIMG_SCALE_FIT_MAX = 7 ; new width ; new height
|
2012-11-13 20:16:23 +01:00
|
|
|
|
2012-11-17 14:24:10 +01:00
|
|
|
; interpolation algorithm
|
|
|
|
LIBIMG_INTER_NONE = 0 ; use it with LIBIMG_SCALE_INTEGER, LIBIMG_SCALE_TILE, etc
|
|
|
|
LIBIMG_INTER_BILINEAR = 1
|
|
|
|
;LIBIMG_INTER_BICUBIC = 2
|
|
|
|
;LIBIMG_INTER_LANCZOS = 3
|
|
|
|
LIBIMG_INTER_DEFAULT = LIBIMG_INTER_BILINEAR
|
2012-11-13 20:16:23 +01:00
|
|
|
|
2012-05-26 01:02:44 +02:00
|
|
|
; error codes
|
2012-11-13 20:16:23 +01:00
|
|
|
LIBIMG_ERROR_OUT_OF_MEMORY = 1
|
|
|
|
LIBIMG_ERROR_FORMAT = 2
|
|
|
|
LIBIMG_ERROR_CONDITIONS = 3
|
|
|
|
LIBIMG_ERROR_BIT_DEPTH = 4
|
|
|
|
LIBIMG_ERROR_ENCODER = 5
|
|
|
|
LIBIMG_ERROR_SRC_TYPE = 6
|
2012-11-17 14:24:10 +01:00
|
|
|
LIBIMG_ERROR_SCALE = 7
|
|
|
|
LIBIMG_ERROR_INTER = 8
|
2012-11-13 20:16:23 +01:00
|
|
|
LIBIMG_ERROR_NOT_INPLEMENTED = 9
|
2012-11-17 14:24:10 +01:00
|
|
|
LIBIMG_ERROR_INVALID_INPUT = 10
|
2012-05-26 01:02:44 +02:00
|
|
|
|
|
|
|
; encode flags (byte 0x02 of _common option)
|
2012-11-13 20:16:23 +01:00
|
|
|
LIBIMG_ENCODE_STRICT_SPECIFIC = 0x01
|
|
|
|
LIBIMG_ENCODE_STRICT_BIT_DEPTH = 0x02
|
|
|
|
LIBIMG_ENCODE_DELETE_ALPHA = 0x08
|
|
|
|
LIBIMG_ENCODE_FLUSH_ALPHA = 0x10
|
|
|
|
|
|
|
|
; convert flags
|
2012-11-18 17:10:28 +01:00
|
|
|
; TBD
|
2008-02-07 23:45:15 +01:00
|
|
|
|
|
|
|
struct FormatsTableEntry
|
2012-05-26 01:02:44 +02:00
|
|
|
Format_id dd ?
|
|
|
|
Is dd ?
|
|
|
|
Decode dd ?
|
|
|
|
Encode dd ?
|
|
|
|
Capabilities dd ?
|
2008-02-07 23:45:15 +01:00
|
|
|
ends
|
|
|
|
|
|
|
|
struct Image
|
2013-05-10 14:28:39 +02:00
|
|
|
Checksum dd ? ; ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far
|
2008-02-07 23:45:15 +01:00
|
|
|
Width dd ?
|
|
|
|
Height dd ?
|
2010-08-25 16:59:27 +02:00
|
|
|
Next dd ?
|
2008-02-07 23:45:15 +01:00
|
|
|
Previous dd ?
|
2009-01-25 19:12:30 +01:00
|
|
|
Type dd ? ; one of Image.bppN
|
2010-08-25 16:59:27 +02:00
|
|
|
Data dd ?
|
2013-05-10 14:28:39 +02:00
|
|
|
Palette dd ? ; used iff Type eq Image.bpp1, Image.bpp2, Image.bpp4 or Image.bpp8i
|
2008-02-07 23:45:15 +01:00
|
|
|
Extended dd ?
|
2009-05-24 18:47:14 +02:00
|
|
|
Flags dd ? ; bitfield
|
|
|
|
Delay dd ? ; used iff Image.IsAnimated is set in Flags
|
2008-02-07 23:45:15 +01:00
|
|
|
ends
|
|
|
|
|
2009-05-24 18:47:14 +02:00
|
|
|
; values for Image.Type
|
|
|
|
; must be consecutive to allow fast switch on Image.Type in support functions
|
2012-06-04 05:54:14 +02:00
|
|
|
Image.bpp8i = 1 ; indexed
|
2009-01-25 19:12:30 +01:00
|
|
|
Image.bpp24 = 2
|
|
|
|
Image.bpp32 = 3
|
2009-05-24 18:47:14 +02:00
|
|
|
Image.bpp15 = 4
|
|
|
|
Image.bpp16 = 5
|
2010-08-25 16:59:27 +02:00
|
|
|
Image.bpp1 = 6
|
2012-06-04 05:54:14 +02:00
|
|
|
Image.bpp8g = 7 ; grayscale
|
2013-05-11 23:31:21 +02:00
|
|
|
Image.bpp2i = 8
|
|
|
|
Image.bpp4i = 9
|
|
|
|
Image.bpp8a = 10 ; grayscale with alpha channel; application layer only!!! kernel doesn't handle this image type, libimg can only create and destroy such images
|
2009-05-24 18:47:14 +02:00
|
|
|
|
|
|
|
; bits in Image.Flags
|
|
|
|
Image.IsAnimated = 1
|
2009-01-25 19:12:30 +01:00
|
|
|
|
2009-06-03 23:12:49 +02:00
|
|
|
struct ImageDecodeOptions
|
|
|
|
UsedSize dd ? ; if >=8, the field BackgroundColor is valid, and so on
|
|
|
|
BackgroundColor dd ? ; used for transparent images as background
|
|
|
|
ends
|
|
|
|
|
2010-08-25 16:59:27 +02:00
|
|
|
FLIP_VERTICAL = 0x01
|
2008-02-07 23:45:15 +01:00
|
|
|
FLIP_HORIZONTAL = 0x02
|
2010-08-25 16:59:27 +02:00
|
|
|
FLIP_BOTH = FLIP_VERTICAL or FLIP_HORIZONTAL
|
2008-03-31 00:31:00 +02:00
|
|
|
|
|
|
|
ROTATE_90_CW = 0x01
|
|
|
|
ROTATE_180 = 0x02
|
|
|
|
ROTATE_270_CW = 0x03
|
|
|
|
ROTATE_90_CCW = ROTATE_270_CW
|
|
|
|
ROTATE_270_CCW = ROTATE_90_CW
|