Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2.  
  3. /** Clears plotting area to a flat colour (if needed)
  4.  */
  5. typedef bool (nsfb_plotfn_clg_t)(nsfb_t *nsfb, nsfb_colour_t c);
  6.  
  7. /** Plots a rectangle outline. The line can be solid, dotted or
  8.  *                dashed. Top left corner at (x0,y0) and rectangle has given
  9.  *                width and height.
  10.  */
  11. typedef bool (nsfb_plotfn_rectangle_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, int line_width, nsfb_colour_t c, bool dotted, bool dashed);
  12.  
  13. /** Plots a line using a given pen.
  14.  */
  15. typedef bool (nsfb_plotfn_line_t)(nsfb_t *nsfb, int linec, nsfb_bbox_t *line, nsfb_plot_pen_t *pen);
  16.  
  17. /** Plots a filled polygon with straight lines between points.
  18.  *                The lines around the edge of the ploygon are not plotted. The
  19.  *                polygon is filled with the non-zero winding rule.
  20.  */
  21. typedef bool (nsfb_plotfn_polygon_t)(nsfb_t *nsfb, const int *p, unsigned int n, nsfb_colour_t fill);
  22.  
  23. /** Plots a filled rectangle. Top left corner at (x0,y0), bottom
  24.  *                right corner at (x1,y1). Note: (x0,y0) is inside filled area,
  25.  *                but (x1,y1) is below and to the right. See diagram below.
  26.  */
  27. typedef bool (nsfb_plotfn_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c);
  28.  
  29. /** Clipping operations.
  30.  */
  31. typedef bool (nsfb_plotfn_clip_t)(nsfb_t *nsfb, nsfb_bbox_t *clip);
  32.  
  33. /** Plots an arc, around (x,y), from anticlockwise from angle1 to
  34.  *                angle2. Angles are measured anticlockwise from horizontal, in
  35.  *                degrees.
  36.  */
  37. typedef bool (nsfb_plotfn_arc_t)(nsfb_t *nsfb, int x, int y, int radius, int angle1, int angle2, nsfb_colour_t c);
  38.  
  39. /** Plots a point.
  40.  *
  41.  * Plot a single alpha blended pixel.
  42.  */
  43. typedef bool (nsfb_plotfn_point_t)(nsfb_t *nsfb, int x, int y, nsfb_colour_t c);
  44.  
  45. /** Plot an ellipse.
  46.  *
  47.  * plot an ellipse outline, note if teh bounding box is square this will plot a
  48.  * circle.
  49.  */
  50. typedef bool (nsfb_plotfn_ellipse_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c);
  51.  
  52. /** Plot a filled ellipse.
  53.  *
  54.  * plot a filled ellipse, note if the bounding box is square this will plot a
  55.  * circle.
  56.  */
  57. typedef bool (nsfb_plotfn_ellipse_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c);
  58.  
  59.  
  60. /** Plot bitmap
  61.  */
  62. typedef bool (nsfb_plotfn_bitmap_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
  63.  
  64.  
  65. /** Copy an area of screen
  66.  *
  67.  * Copy an area of the display.
  68.  */
  69. typedef bool (nsfb_plotfn_copy_t)(nsfb_t *nsfb, nsfb_bbox_t *srcbox, nsfb_bbox_t *dstbox);
  70.  
  71.  
  72. /** Plot an 8 bit per pixel glyph.
  73.  */
  74. typedef bool (nsfb_plotfn_glyph8_t)(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c);
  75.  
  76.  
  77. /** Plot an 1 bit per pixel glyph.
  78.  */
  79. typedef bool (nsfb_plotfn_glyph1_t)(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c);
  80.  
  81. /** Read rectangle of screen into buffer
  82.  */
  83. typedef bool (nsfb_plotfn_readrect_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer);
  84.  
  85. /** Plot quadratic bezier spline
  86.  */
  87. typedef bool (nsfb_plotfn_quadratic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_plot_pen_t *pen);
  88.  
  89. /** Plot cubic bezier spline
  90.  */
  91. typedef bool (nsfb_plotfn_cubic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_plot_pen_t *pen);
  92.  
  93. typedef bool (nsfb_plotfn_polylines_t)(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen);
  94.  
  95. /** plot path */
  96. typedef bool (nsfb_plotfn_path_t)(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen);
  97.  
  98. /** plotter function table. */
  99. typedef struct nsfb_plotter_fns_s {
  100.     nsfb_plotfn_clg_t *clg;
  101.     nsfb_plotfn_rectangle_t *rectangle;
  102.     nsfb_plotfn_line_t *line;
  103.     nsfb_plotfn_polygon_t *polygon;
  104.     nsfb_plotfn_fill_t *fill;
  105.     nsfb_plotfn_clip_t *get_clip;
  106.     nsfb_plotfn_clip_t *set_clip;
  107.     nsfb_plotfn_ellipse_t *ellipse;
  108.     nsfb_plotfn_ellipse_fill_t *ellipse_fill;
  109.     nsfb_plotfn_arc_t *arc;
  110.     nsfb_plotfn_bitmap_t *bitmap;
  111.     nsfb_plotfn_point_t *point;
  112.     nsfb_plotfn_copy_t *copy;
  113.     nsfb_plotfn_glyph8_t *glyph8;
  114.     nsfb_plotfn_glyph1_t *glyph1;
  115.     nsfb_plotfn_readrect_t *readrect;
  116.     nsfb_plotfn_quadratic_bezier_t *quadratic;
  117.     nsfb_plotfn_cubic_bezier_t *cubic;
  118.     nsfb_plotfn_path_t *path;
  119.     nsfb_plotfn_polylines_t *polylines;
  120. } nsfb_plotter_fns_t;
  121.  
  122.  
  123. bool select_plotters(nsfb_t *nsfb);
  124.  
  125.