Subversion Repositories Kolibri OS

Rev

Rev 6456 | Rev 6495 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #ifndef KOLIBRI_BUF2D_H
  2. #define KOLIBRI_BUF2D_H
  3.  
  4. /*ToDo
  5.  * voxel function
  6.  */
  7.  
  8. extern int init_buf2d_asm(void);
  9.  
  10. int kolibri_buf2d_init(void)
  11. {
  12.   int asm_init_status = init_buf2d_asm();
  13.  
  14.   /* just return asm_init_status? or return init_boxlib_asm() ?*/
  15.  
  16.   if(asm_init_status == 0)
  17.     return 0;
  18.   else
  19.     return 1;
  20. }
  21.  
  22.  
  23. typedef struct {
  24.         unsigned int *buf_pointer;
  25.         uint16_t left;                  
  26.         uint16_t top;                
  27.         unsigned int width;  
  28.         unsigned int height;    
  29.         unsigned int bgcolor;          
  30.         uint8_t color_bit;            
  31. }buf2d_struct;
  32.  
  33. enum BUF2D_ALGORITM_FILTR {
  34.         SIERRA_LITE,
  35.         FLOYD_STEINBERG,
  36.         BURKERS,
  37.         HEAVYIRON_MOD,
  38.         ATKINSON
  39. };
  40.  
  41. enum BUF2D_OPT_CROP {
  42.         BUF2D_OPT_CROP_TOP = 1,
  43.         BUF2D_OPT_CROP_LEFT = 2,
  44.         BUF2D_OPT_CROP_BOTTOM = 4,
  45.         BUF2D_OPT_CROP_RIGHT = 8
  46. };
  47.  
  48. extern void (*buf2d_create_asm)(buf2d_struct *) __attribute__((__stdcall__));
  49. extern void (*buf2d_curve_bezier_asm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  50.  
  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)
  52. {
  53.     buf2d_struct *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(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. 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)
  65. {
  66.         buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
  67. }
  68.  
  69. extern void (*buf2d_draw)(buf2d_struct *) __attribute__((__stdcall__));
  70. extern void (*buf2d_clear)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  71. extern void (*buf2d_delete)(buf2d_struct *) __attribute__((__stdcall__));
  72. extern void (*buf2d_rotate)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  73. extern void (*buf2d_resize)(buf2d_struct *, 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__));
  75. extern void (*buf2d_line_sm)(buf2d_struct *, 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__));
  77. extern void (*buf2d_filled_rect_by_size)(buf2d_struct *, unsigned int, 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__));
  79. extern void (*buf2d_img_hdiv2)(buf2d_struct *) __attribute__((__stdcall__));
  80. extern void (*buf2d_img_wdiv2)(buf2d_struct *) __attribute__((__stdcall__));
  81. extern void (*buf2d_conv_24_to_8)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  82. extern void (*buf2d_conv_24_to_32)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  83. extern void (*buf2d_bit_blt_transp)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__));
  84. extern void (*buf2d_bit_blt_alpha)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__));
  85. extern void (*buf2d_convert_text_matrix)(buf2d_struct *) __attribute__((__stdcall__));
  86. extern void (*buf2d_draw_text)(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__));
  87. extern void (*buf2d_crop_color)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
  88. extern void (*buf2d_offset_h)(buf2d_struct *, 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__));
  90. extern void (*buf2d_set_pixel)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
  91. extern unsigned int (*buf2d_get_pixel)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
  92. extern void (*buf2d_flip_h)(buf2d_struct *) __attribute__((__stdcall__));
  93. extern void (*buf2d_flip_v)(buf2d_struct *) __attribute__((__stdcall__));
  94. extern void (*buf2d_filter_dither)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
  95. #endif /* KOLIBRI_BUF2D_H */
  96.