Subversion Repositories Kolibri OS

Rev

Rev 6452 | Rev 6457 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6451 punk_joker 1
#ifndef KOLIBRI_BUF2D_H
2
#define KOLIBRI_BUF2D_H
3
 
4
/*ToDo
5
 * buf_curve_bezier
6
 * voxel function
7
 */
8
 
9
extern int init_buf2d_asm(void);
10
 
11
int kolibri_buf2d_init(void)
12
{
13
  int asm_init_status = init_buf2d_asm();
14
 
15
  /* just return asm_init_status? or return init_boxlib_asm() ?*/
16
 
17
  if(asm_init_status == 0)
18
    return 0;
19
  else
20
    return 1;
21
}
22
 
23
 
24
struct buf2d_struct {
25
	unsigned int *buf_pointer;
26
	uint16_t left;
27
	uint16_t top;
28
	unsigned int width;
29
	unsigned int height;
30
	unsigned int bgcolor;
31
	uint8_t color_bit;
32
};
33
 
34
enum BUF2D_ALGORITM_FILTR {
35
	SIERRA_LITE,
36
	FLOYD_STEINBERG,
37
	BURKERS,
38
	HEAVYIRON_MOD,
39
	ATKINSON
40
};
41
 
42
enum BUF2D_OPT_CROP {
43
	BUF2D_OPT_CROP_TOP = 1,
44
	BUF2D_OPT_CROP_LEFT = 2,
45
	BUF2D_OPT_CROP_BOTTOM = 4,
46
	BUF2D_OPT_CROP_RIGHT = 8
47
};
48
 
49
extern void (*buf2d_create_asm)(struct buf2d_struct *) __attribute__((__stdcall__));
6452 punk_joker 50
extern void (*buf2d_curve_bezier_asm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
6451 punk_joker 51
 
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)
53
{
54
    struct buf2d_struct *new_buf2d_struct = (struct buf2d_struct *)malloc(sizeof(struct buf2d_struct));
55
    new_buf2d_struct -> left = tlx;
56
	new_buf2d_struct -> top = tly;
57
	new_buf2d_struct -> width = sizex;
58
	new_buf2d_struct -> height = sizey;
59
	new_buf2d_struct -> bgcolor = font_bgcolor;
60
	new_buf2d_struct -> color_bit = color_bit;
61
	buf2d_create_asm(new_buf2d_struct);
62
    return new_buf2d_struct;
63
}
64
 
6452 punk_joker 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)
66
{
67
	buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
68
}
69
 
6451 punk_joker 70
extern void (*buf2d_draw)(struct buf2d_struct *) __attribute__((__stdcall__));
71
extern void (*buf2d_clear)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
72
extern void (*buf2d_delete)(struct buf2d_struct *) __attribute__((__stdcall__));
73
extern void (*buf2d_rotate)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
74
extern void (*buf2d_resize)(struct 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__));
76
extern void (*buf2d_line_sm)(struct 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__));
78
extern void (*buf2d_filled_rect_by_size)(struct 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__));
80
extern void (*buf2d_img_hdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
81
extern void (*buf2d_img_wdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
82
extern void (*buf2d_conv_24_to_8)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
83
extern void (*buf2d_conv_24_to_32)(struct 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__));
85
extern void (*buf2d_bit_blt_alpha)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
86
extern void (*buf2d_convert_text_matrix)(struct buf2d_struct *) __attribute__((__stdcall__));
87
extern void (*buf2d_draw_text)(struct buf2d_struct *, 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__));
89
extern void (*buf2d_offset_h)(struct 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__));
91
extern void (*buf2d_set_pixel)(struct 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__));
93
extern void (*buf2d_flip_h)(struct buf2d_struct *) __attribute__((__stdcall__));
94
extern void (*buf2d_flip_v)(struct buf2d_struct *) __attribute__((__stdcall__));
95
extern void (*buf2d_filter_dither)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
96
#endif /* KOLIBRI_BUF2D_H */