Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  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__));
  50.  
  51. 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)
  52. {
  53.     struct buf2d_struct *new_buf2d_struct = (struct buf2d_struct *)malloc(sizeof(struct buf2d_struct));
  54.     new_buf2d_struct -> left = tlx;
  55.         new_buf2d_struct -> top = tly;    
  56.         new_buf2d_struct -> width = sizex;
  57.         new_buf2d_struct -> height = sizey;
  58.         new_buf2d_struct -> bgcolor = font_bgcolor;
  59.         new_buf2d_struct -> color_bit = color_bit;
  60.         buf2d_create_asm(new_buf2d_struct);
  61.     return new_buf2d_struct;
  62. }
  63.  
  64. extern void (*buf2d_draw)(struct buf2d_struct *) __attribute__((__stdcall__));
  65. extern void (*buf2d_clear)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  66. extern void (*buf2d_delete)(struct buf2d_struct *) __attribute__((__stdcall__));
  67. extern void (*buf2d_rotate)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  68. extern void (*buf2d_resize)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  69. extern void (*buf2d_line)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  70. extern void (*buf2d_line_sm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  71. extern void (*buf2d_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  72. extern void (*buf2d_filled_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  73. extern void (*buf2d_circle)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  74. extern void (*buf2d_img_hdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
  75. extern void (*buf2d_img_wdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
  76. extern void (*buf2d_conv_24_to_8)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  77. extern void (*buf2d_conv_24_to_32)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  78. extern void (*buf2d_bit_blt_transp)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
  79. extern void (*buf2d_bit_blt_alpha)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
  80. extern void (*buf2d_convert_text_matrix)(struct buf2d_struct *) __attribute__((__stdcall__));
  81. extern void (*buf2d_draw_text)(struct buf2d_struct *, struct buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__));
  82. extern void (*buf2d_crop_color)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
  83. extern void (*buf2d_offset_h)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  84. extern void (*buf2d_flood_fill)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  85. extern void (*buf2d_set_pixel)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  86. extern unsigned int (*buf2d_get_pixel)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
  87. extern void (*buf2d_flip_h)(struct buf2d_struct *) __attribute__((__stdcall__));
  88. extern void (*buf2d_flip_v)(struct buf2d_struct *) __attribute__((__stdcall__));
  89. extern void (*buf2d_filter_dither)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  90. #endif /* KOLIBRI_BUF2D_H */
  91.