2009-01-17 00:12:10 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
image.h
|
|
|
|
|
2013-08-03 17:38:01 +02:00
|
|
|
(c) 2000-2013 Benoît Minisini <gambas@users.sourceforge.net>
|
2009-01-17 00:12:10 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2009-01-17 00:12:10 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2009-01-17 00:12:10 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __IMAGE_H
|
|
|
|
#define __IMAGE_H
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
2011-04-26 02:13:38 +02:00
|
|
|
#ifndef __IMAGE_C
|
|
|
|
extern bool IMAGE_debug;
|
|
|
|
#endif
|
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
static inline int RED(uint rgba) { return ((rgba >> 16) & 0xff); }
|
|
|
|
static inline int GREEN(uint rgba) { return ((rgba >> 8) & 0xff); }
|
|
|
|
static inline int BLUE(uint rgba) { return (rgba & 0xff); }
|
|
|
|
static inline int ALPHA(uint rgba) { return ((rgba >> 24) & 0xff); }
|
|
|
|
static inline uint RGB(int r, int g, int b) { return (0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
|
|
|
|
static inline uint RGBA(int r, int g, int b, int a) { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
|
|
|
|
static inline int GRAY(uint rgba) { return (RED(rgba) * 11 + GREEN(rgba) * 16 + BLUE(rgba) * 5) / 32; }
|
|
|
|
|
|
|
|
int IMAGE_size(GB_IMG *img);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_create(GB_IMG *img, int width, int height, int format);
|
|
|
|
void IMAGE_create_with_data(GB_IMG *img, int width, int height, int format, unsigned char *data);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_take(GB_IMG *img, GB_IMG_OWNER *owner, void *owner_handle, int width, int height, unsigned char *data);
|
2009-01-27 14:39:38 +01:00
|
|
|
void *IMAGE_check(GB_IMG *img, GB_IMG_OWNER *temp_owner);
|
2010-06-19 14:38:28 +02:00
|
|
|
void IMAGE_synchronize(GB_IMG *img);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_delete(GB_IMG *img);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-27 02:24:19 +01:00
|
|
|
void IMAGE_convert(GB_IMG *img, int format);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_fill(GB_IMG *img, GB_COLOR col);
|
2010-08-24 12:56:55 +02:00
|
|
|
void IMAGE_fill_rect(GB_IMG *img, int x, int y, int w, int h, GB_COLOR col, bool opaque);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_make_gray(GB_IMG *img);
|
|
|
|
void IMAGE_make_transparent(GB_IMG *img, GB_COLOR color);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
GB_COLOR IMAGE_get_pixel(GB_IMG *img, int x, int y);
|
|
|
|
void IMAGE_set_pixel(GB_IMG *img, int x, int y, GB_COLOR col);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
|
|
|
void IMAGE_get_pixels(GB_IMG *img, int *data);
|
|
|
|
void IMAGE_set_pixels(GB_IMG *img, int *data);
|
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
void IMAGE_replace(GB_IMG *img, GB_COLOR src, GB_COLOR dst, bool noteq);
|
2013-05-30 23:16:09 +02:00
|
|
|
|
2009-01-21 02:25:13 +01:00
|
|
|
void IMAGE_set_default_format(int format);
|
|
|
|
int IMAGE_get_default_format();
|
2013-05-30 23:16:09 +02:00
|
|
|
const char *IMAGE_format_to_string(int fmt);
|
|
|
|
|
2011-05-01 04:54:51 +02:00
|
|
|
void IMAGE_bitblt(GB_IMG *dst, int dx, int dy, int dw, int dh, GB_IMG *src, int sx, int sy, int sw, int sh);
|
2010-08-12 21:13:44 +02:00
|
|
|
void IMAGE_draw_alpha(GB_IMG *dst, int dx, int dy, GB_IMG *src, int sx, int sy, int sw, int sh);
|
2011-05-01 04:54:51 +02:00
|
|
|
void IMAGE_compose(GB_IMG *dst, int dx, int dy, int dw, int dh, GB_IMG *src, int sx, int sy, int sw, int sh);
|
2009-02-13 01:12:07 +01:00
|
|
|
void IMAGE_colorize(GB_IMG *img, GB_COLOR color);
|
2009-12-29 12:56:43 +01:00
|
|
|
void IMAGE_mask(GB_IMG *img, GB_COLOR color);
|
2009-08-17 00:07:48 +02:00
|
|
|
void IMAGE_mirror(GB_IMG *src, GB_IMG *dst, bool horizontal, bool vertical);
|
2012-08-16 22:33:21 +02:00
|
|
|
void IMAGE_rotate(GB_IMG *src, GB_IMG *dst, bool left);
|
2009-08-18 00:36:54 +02:00
|
|
|
void IMAGE_transform(GB_IMG *dst, GB_IMG *src, double sx, double sy, double sdx, double sdy);
|
2012-04-22 23:27:59 +02:00
|
|
|
void IMAGE_set_opacity(GB_IMG *dst, uchar opacity);
|
2013-01-02 16:56:24 +01:00
|
|
|
void IMAGE_blur(GB_IMG *img, int radius);
|
2013-08-07 05:14:27 +02:00
|
|
|
void IMAGE_balance(GB_IMG *img, int brightness, int contrast, int gamma, int hue, int saturation, int lightness);
|
2011-04-26 02:13:38 +02:00
|
|
|
|
2011-02-25 01:26:22 +01:00
|
|
|
#define IMAGE_is_void(_image) ((_image)->is_void)
|
|
|
|
|
2009-01-27 18:07:47 +01:00
|
|
|
#endif
|