Rev 6456 | Rev 6495 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6456 | Rev 6457 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef KOLIBRI_BUF2D_H |
1 | #ifndef KOLIBRI_BUF2D_H |
2 | #define KOLIBRI_BUF2D_H |
2 | #define KOLIBRI_BUF2D_H |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | /*ToDo |
- | |
5 | * buf_curve_bezier |
4 | /*ToDo |
6 | * voxel function |
5 | * voxel function |
Line 7... | Line 6... | ||
7 | */ |
6 | */ |
Line 19... | Line 18... | ||
19 | else |
18 | else |
20 | return 1; |
19 | return 1; |
21 | } |
20 | } |
Line 22... | Line 21... | ||
22 | 21 | ||
23 | 22 | ||
24 | struct buf2d_struct { |
23 | typedef struct { |
25 | unsigned int *buf_pointer; |
24 | unsigned int *buf_pointer; |
26 | uint16_t left; |
25 | uint16_t left; |
27 | uint16_t top; |
26 | uint16_t top; |
28 | unsigned int width; |
27 | unsigned int width; |
29 | unsigned int height; |
28 | unsigned int height; |
30 | unsigned int bgcolor; |
29 | unsigned int bgcolor; |
Line 31... | Line 30... | ||
31 | uint8_t color_bit; |
30 | uint8_t color_bit; |
32 | }; |
31 | }buf2d_struct; |
33 | 32 | ||
34 | enum BUF2D_ALGORITM_FILTR { |
33 | enum BUF2D_ALGORITM_FILTR { |
Line 44... | Line 43... | ||
44 | BUF2D_OPT_CROP_LEFT = 2, |
43 | BUF2D_OPT_CROP_LEFT = 2, |
45 | BUF2D_OPT_CROP_BOTTOM = 4, |
44 | BUF2D_OPT_CROP_BOTTOM = 4, |
46 | BUF2D_OPT_CROP_RIGHT = 8 |
45 | BUF2D_OPT_CROP_RIGHT = 8 |
47 | }; |
46 | }; |
Line 48... | Line 47... | ||
48 | 47 | ||
49 | extern void (*buf2d_create_asm)(struct buf2d_struct *) __attribute__((__stdcall__)); |
48 | extern void (*buf2d_create_asm)(buf2d_struct *) __attribute__((__stdcall__)); |
Line 50... | Line 49... | ||
50 | extern void (*buf2d_curve_bezier_asm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
49 | extern void (*buf2d_curve_bezier_asm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
51 | 50 | ||
52 | struct buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit) |
51 | buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit) |
53 | { |
52 | { |
54 | struct buf2d_struct *new_buf2d_struct = (struct buf2d_struct *)malloc(sizeof(struct buf2d_struct)); |
53 | buf2d_struct *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(buf2d_struct)); |
55 | new_buf2d_struct -> left = tlx; |
54 | new_buf2d_struct -> left = tlx; |
56 | new_buf2d_struct -> top = tly; |
55 | new_buf2d_struct -> top = tly; |
57 | new_buf2d_struct -> width = sizex; |
56 | new_buf2d_struct -> width = sizex; |
58 | new_buf2d_struct -> height = sizey; |
57 | new_buf2d_struct -> height = sizey; |
59 | new_buf2d_struct -> bgcolor = font_bgcolor; |
58 | new_buf2d_struct -> bgcolor = font_bgcolor; |
60 | new_buf2d_struct -> color_bit = color_bit; |
59 | new_buf2d_struct -> color_bit = color_bit; |
61 | buf2d_create_asm(new_buf2d_struct); |
60 | buf2d_create_asm(new_buf2d_struct); |
Line 62... | Line 61... | ||
62 | return new_buf2d_struct; |
61 | return new_buf2d_struct; |
63 | } |
62 | } |
64 | 63 | ||
65 | void buf2d_curve_bezier(struct buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color) |
64 | void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color) |
Line 66... | Line 65... | ||
66 | { |
65 | { |
67 | buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color); |
66 | buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color); |
68 | } |
67 | } |
69 | 68 | ||
70 | extern void (*buf2d_draw)(struct buf2d_struct *) __attribute__((__stdcall__)); |
69 | extern void (*buf2d_draw)(buf2d_struct *) __attribute__((__stdcall__)); |
71 | extern void (*buf2d_clear)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
70 | extern void (*buf2d_clear)(buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
72 | extern void (*buf2d_delete)(struct buf2d_struct *) __attribute__((__stdcall__)); |
71 | extern void (*buf2d_delete)(buf2d_struct *) __attribute__((__stdcall__)); |
73 | extern void (*buf2d_rotate)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
72 | extern void (*buf2d_rotate)(buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
74 | extern void (*buf2d_resize)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
73 | extern void (*buf2d_resize)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
75 | extern void (*buf2d_line)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
74 | extern void (*buf2d_line)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
76 | extern void (*buf2d_line_sm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
75 | extern void (*buf2d_line_sm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
77 | extern void (*buf2d_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
76 | extern void (*buf2d_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
78 | extern void (*buf2d_filled_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
77 | extern void (*buf2d_filled_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
79 | extern void (*buf2d_circle)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
78 | extern void (*buf2d_circle)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
80 | extern void (*buf2d_img_hdiv2)(struct buf2d_struct *) __attribute__((__stdcall__)); |
79 | extern void (*buf2d_img_hdiv2)(buf2d_struct *) __attribute__((__stdcall__)); |
81 | extern void (*buf2d_img_wdiv2)(struct buf2d_struct *) __attribute__((__stdcall__)); |
80 | extern void (*buf2d_img_wdiv2)(buf2d_struct *) __attribute__((__stdcall__)); |
82 | extern void (*buf2d_conv_24_to_8)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
81 | extern void (*buf2d_conv_24_to_8)(buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
83 | extern void (*buf2d_conv_24_to_32)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
82 | extern void (*buf2d_conv_24_to_32)(buf2d_struct *, unsigned int) __attribute__((__stdcall__)); |
84 | extern void (*buf2d_bit_blt_transp)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__)); |
83 | extern void (*buf2d_bit_blt_transp)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__)); |
85 | extern void (*buf2d_bit_blt_alpha)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__)); |
84 | extern void (*buf2d_bit_blt_alpha)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__)); |
86 | extern void (*buf2d_convert_text_matrix)(struct buf2d_struct *) __attribute__((__stdcall__)); |
85 | extern void (*buf2d_convert_text_matrix)(buf2d_struct *) __attribute__((__stdcall__)); |
87 | extern void (*buf2d_draw_text)(struct buf2d_struct *, struct buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__)); |
86 | extern void (*buf2d_draw_text)(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__)); |
88 | extern void (*buf2d_crop_color)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__)); |
87 | extern void (*buf2d_crop_color)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__)); |
89 | extern void (*buf2d_offset_h)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
88 | extern void (*buf2d_offset_h)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
90 | extern void (*buf2d_flood_fill)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
89 | extern void (*buf2d_flood_fill)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
91 | extern void (*buf2d_set_pixel)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
90 | extern void (*buf2d_set_pixel)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__)); |
92 | extern unsigned int (*buf2d_get_pixel)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__)); |
91 | extern unsigned int (*buf2d_get_pixel)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__)); |