aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/include/evas_common_soft16.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/include/evas_common_soft16.h')
-rw-r--r--libraries/evas/src/lib/include/evas_common_soft16.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/include/evas_common_soft16.h b/libraries/evas/src/lib/include/evas_common_soft16.h
new file mode 100644
index 0000000..446319e
--- /dev/null
+++ b/libraries/evas/src/lib/include/evas_common_soft16.h
@@ -0,0 +1,100 @@
1#ifndef EVAS_COMMON_SOFT16_H
2#define EVAS_COMMON_SOFT16_H
3
4#include "evas_common.h"
5#include "evas_private.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define RGB_565_UNPACKED_MASK 0x07e0f81f
12#define RGB_565_UNPACK(rgb) \
13 (((rgb) | ((rgb) << 16)) & RGB_565_UNPACKED_MASK)
14#define RGB_565_PACK(rgb) \
15 ((((rgb) & RGB_565_UNPACKED_MASK) | \
16 ((rgb) & RGB_565_UNPACKED_MASK) >> 16) & 0xffff)
17#define RGB_565_UNPACKED_BLEND(a, b, alpha) \
18 ((b) + (a) - ((((b) * (alpha)) >> 5) & RGB_565_UNPACKED_MASK))
19#define RGB_565_UNPACKED_BLEND_UNMUL(a, b, alpha) \
20 ((b) + ((((a) - (b)) * (alpha)) >> 5))
21
22#define RGB_565_FROM_COMPONENTS(r, g, b) \
23 (((((r) >> 3) & 0x1f) << 11) | \
24 ((((g) >> 2) & 0x3f) << 5) | \
25 (((b) >> 3) & 0x1f))
26
27static inline unsigned int
28_calc_stride(unsigned int w)
29{
30 unsigned int pad = w % 4;
31 if (!pad) return w;
32 else return w + 4 - pad;
33}
34
35#define IMG_BYTE_SIZE(stride, height, has_alpha) \
36 ((stride) * (height) * (!(has_alpha) ? 2 : 3))
37
38typedef struct _Soft16_Image Soft16_Image;
39struct _Soft16_Image
40{
41 Image_Entry cache_entry;
42
43 RGBA_Image *source;
44
45 int stride; // pixel stride - likely a multiple of 2
46 DATA16 *pixels; // 16bpp pixels rgb565
47 DATA8 *alpha; // 8bit alpha mask - optional. points into pixels
48
49 struct
50 {
51/* unsigned char have_alpha : 1; // 1 if we have halpha */
52 unsigned char free_pixels : 1; // 1 if pixels should be freed
53 unsigned char free_alpha : 1; // 1 if alpha mask should be freed
54 } flags;
55};
56
57/**
58 * Image (evas_soft16_main.c)
59 */
60EAPI void evas_common_soft16_image_init(void);
61EAPI void evas_common_soft16_image_shutdown(void);
62EAPI Evas_Cache_Image *evas_common_soft16_image_cache_get(void);
63
64EAPI void evas_common_soft16_image_draw(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth);
65EAPI Soft16_Image *evas_common_soft16_image_alpha_set(Soft16_Image *im, int have_alpha);
66
67void evas_common_soft16_image_draw_unscaled(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr);
68void evas_common_soft16_image_draw_scaled_sampled(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr);
69
70/* convert/dither functions */
71void evas_common_soft16_image_convert_from_rgb(Soft16_Image *im, const DATA32 *src);
72void evas_common_soft16_image_convert_from_rgba(Soft16_Image *im, const DATA32 *src);
73
74/**
75 * Rectangle (evas_soft16_rectangle.c)
76 */
77EAPI void evas_common_soft16_rectangle_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
78
79/**
80 * Polygon (evas_soft16_polygon.c)
81 */
82 EAPI void evas_common_soft16_polygon_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y);
83
84/**
85 * Line (evas_soft16_line.c)
86 */
87EAPI void evas_common_soft16_line_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
88
89/**
90 * Font (evas_soft16_font.c)
91 */
92EAPI void *evas_common_soft16_font_glyph_new(void *data, RGBA_Font_Glyph *fg);
93EAPI void evas_common_soft16_font_glyph_free(void *ext_dat);
94EAPI void evas_common_soft16_font_glyph_draw(void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif