NetSurf
|
RISC OS screen plotter implementation. More...
#include <stdbool.h>
#include <math.h>
#include "oslib/colourtrans.h"
#include "oslib/draw.h"
#include "oslib/os.h"
#include "utils/log.h"
#include "netsurf/plotters.h"
#include "riscos/bitmap.h"
#include "riscos/image.h"
#include "riscos/gui.h"
#include "riscos/font.h"
#include "riscos/oslib_pre7.h"
Go to the source code of this file.
Functions | |
static nserror | ro_plot_draw_path (const draw_path *const path, int width, colour c, bool dotted, bool dashed) |
plot a path on RISC OS More... | |
static nserror | ro_plot_clip (const struct redraw_context *ctx, const struct rect *clip) |
Sets a clip rectangle for subsequent plot operations. More... | |
static nserror | ro_plot_arc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius, int angle1, int angle2) |
Plots an arc. More... | |
static nserror | ro_plot_disc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) |
Plots a circle. More... | |
static nserror | ro_plot_line (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) |
Plots a line. More... | |
static nserror | ro_plot_rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) |
Plots a rectangle. More... | |
static nserror | ro_plot_polygon (const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n) |
Plot a polygon. More... | |
static nserror | ro_plot_path (const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6]) |
Plots a path. More... | |
static nserror | ro_plot_bitmap (const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags) |
Plot a bitmap. More... | |
static nserror | ro_plot_text (const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length) |
Text plotting. More... | |
Variables | |
int | ro_plot_origin_x = 0 |
int | ro_plot_origin_y = 0 |
struct rect | ro_plot_clip_rect |
bool | ro_plot_patterned_lines = true |
One version of the A9home OS is incapable of drawing patterned lines. More... | |
const struct plotter_table | ro_plotters |
RISC OS plotter operation table. More... | |
RISC OS screen plotter implementation.
Definition in file plotters.c.
|
static |
Plots an arc.
plot an arc segment around (x,y), anticlockwise from angle1 to angle2. Angles are measured anticlockwise from horizontal, in degrees.
ctx | The current redraw context. |
style | Style controlling the arc plot. |
x | The x coordinate of the arc. |
y | The y coordinate of the arc. |
radius | The radius of the arc. |
angle1 | The start angle of the arc. |
angle2 | The finish angle of the arc. |
Definition at line 176 of file plotters.c.
References plot_style_s::fill_colour, M_PI, NSERROR_INVALID, NSERROR_OK, NSLOG, ro_plot_origin_x, and ro_plot_origin_y.
|
static |
Plot a bitmap.
Tiled plot of a bitmap image. (x,y) gives the top left coordinate of an explicitly placed tile. From this tile the image can repeat in all four directions – up, down, left and right – to the extents given by the current clip rectangle.
The bitmap_flags say whether to tile in the x and y directions. If not tiling in x or y directions, the single image is plotted. The width and height give the dimensions the image is to be scaled to.
ctx | The current redraw context. |
bitmap | The bitmap to plot |
x | The x coordinate to plot the bitmap |
y | The y coordiante to plot the bitmap |
width | The width of area to plot the bitmap into |
height | The height of area to plot the bitmap into |
bg | the background colour to alpha blend into |
flags | the flags controlling the type of plot operation |
Definition at line 650 of file plotters.c.
References BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, buffer, bitmap::height, height, IMAGE_PLOT_TINCT_ALPHA, IMAGE_PLOT_TINCT_OPAQUE, image_redraw(), NSERROR_INVALID, NSERROR_OK, NSLOG, riscos_bitmap_get_buffer(), riscos_bitmap_get_opaque(), ro_plot_origin_x, ro_plot_origin_y, bitmap::sprite_area, bitmap::width, and width.
|
static |
Sets a clip rectangle for subsequent plot operations.
ctx | The current redraw context. |
clip | The rectangle to limit all subsequent plot operations within. |
Definition at line 109 of file plotters.c.
References clip(), NSERROR_BAD_SIZE, NSERROR_INVALID, NSERROR_OK, NSLOG, ro_plot_clip_rect, ro_plot_origin_x, ro_plot_origin_y, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Plots a circle.
Plot a circle centered on (x,y), which is optionally filled.
ctx | The current redraw context. |
style | Style controlling the circle plot. |
x | The x coordinate of the circle. |
y | The y coordinate of the circle. |
radius | The radius of the circle. |
Definition at line 243 of file plotters.c.
References plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_INVALID, NSERROR_OK, NSLOG, PLOT_OP_TYPE_NONE, ro_plot_origin_x, ro_plot_origin_y, plot_style_s::stroke_colour, and plot_style_s::stroke_type.
|
static |
plot a path on RISC OS
Definition at line 51 of file plotters.c.
References NSERROR_INVALID, NSERROR_OK, NSLOG, path(), ro_plot_patterned_lines, and width.
Referenced by ro_plot_line(), and ro_plot_rectangle().
|
static |
Plots a line.
plot a line from (x0,y0) to (x1,y1). Coordinates are at centre of line width/thickness.
ctx | The current redraw context. |
style | Style controlling the line plot. |
line | A rectangle defining the line to be drawn |
Definition at line 318 of file plotters.c.
References line(), NSERROR_OK, path(), PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, ro_plot_draw_path(), ro_plot_origin_x, ro_plot_origin_y, plot_style_s::stroke_colour, plot_style_s::stroke_type, and plot_style_s::stroke_width.
|
static |
Plots a path.
Path plot consisting of cubic Bezier curves. Line and fill colour is controlled by the plot style.
ctx | The current redraw context. |
pstyle | Style controlling the path plot. |
p | elements of path |
n | nunber of elements on path |
transform | A transform to apply to the path. |
Definition at line 504 of file plotters.c.
References plot_style_s::fill_colour, NS_TRANSPARENT, NSERROR_INVALID, NSERROR_OK, NSLOG, path(), plot_style_fixed_to_int, PLOTTER_PATH_BEZIER, PLOTTER_PATH_CLOSE, PLOTTER_PATH_LINE, PLOTTER_PATH_MOVE, ro_plot_origin_x, ro_plot_origin_y, plot_style_s::stroke_colour, and plot_style_s::stroke_width.
|
static |
Plot a polygon.
Plots a filled polygon with straight lines between points. The lines around the edge of the ploygon are not plotted. The polygon is filled with the non-zero winding rule.
ctx | The current redraw context. |
style | Style controlling the polygon plot. |
p | verticies of polygon |
n | number of verticies. |
Definition at line 454 of file plotters.c.
References plot_style_s::fill_colour, NSERROR_INVALID, NSERROR_OK, NSLOG, path(), ro_plot_origin_x, and ro_plot_origin_y.
|
static |
Plots a rectangle.
The rectangle can be filled an outline or both controlled by the plot style The line can be solid, dotted or dashed. Top left corner at (x0,y0) and rectangle has given width and height.
ctx | The current redraw context. |
style | Style controlling the rectangle plot. |
rect | A rectangle defining the line to be drawn |
Definition at line 363 of file plotters.c.
References colourtrans_USE_ECFS_GCOL, plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_INVALID, NSERROR_OK, NSLOG, path(), PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, ro_plot_draw_path(), ro_plot_origin_x, ro_plot_origin_y, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Text plotting.
ctx | The current redraw context. |
fstyle | plot style for this text |
x | x coordinate |
y | y coordinate |
text | UTF-8 string to plot |
length | length of string, in bytes |
Definition at line 695 of file plotters.c.
References plot_font_style::background, plot_font_style::foreground, NSERROR_INVALID, NSERROR_OK, nsfont_paint(), NSLOG, ro_plot_origin_x, ro_plot_origin_y, and text().
struct rect ro_plot_clip_rect |
Definition at line 42 of file plotters.c.
Referenced by ro_cw_redraw(), ro_gui_window__redraw_rect(), and ro_plot_clip().
int ro_plot_origin_x = 0 |
Definition at line 40 of file plotters.c.
Referenced by cookie_draw(), global_history_draw(), hotlist_draw(), print_document(), riscos_bitmap_render(), ro_gui_buffer_close(), ro_gui_buffer_open(), ro_gui_progress_bar_redraw_window(), ro_gui_status_bar_redraw(), ro_gui_url_bar_redraw(), ro_gui_window__redraw_rect(), ro_local_history_draw(), ro_pageinfo_draw(), ro_plot_arc(), ro_plot_bitmap(), ro_plot_clip(), ro_plot_disc(), ro_plot_line(), ro_plot_path(), ro_plot_polygon(), ro_plot_rectangle(), ro_plot_text(), and ro_toolbar_redraw().
int ro_plot_origin_y = 0 |
Definition at line 41 of file plotters.c.
Referenced by cookie_draw(), global_history_draw(), hotlist_draw(), print_document(), riscos_bitmap_render(), ro_gui_buffer_close(), ro_gui_buffer_open(), ro_gui_progress_bar_redraw_window(), ro_gui_status_bar_redraw(), ro_gui_url_bar_redraw(), ro_gui_window__redraw_rect(), ro_local_history_draw(), ro_pageinfo_draw(), ro_plot_arc(), ro_plot_bitmap(), ro_plot_clip(), ro_plot_disc(), ro_plot_line(), ro_plot_path(), ro_plot_polygon(), ro_plot_rectangle(), ro_plot_text(), and ro_toolbar_redraw().
bool ro_plot_patterned_lines = true |
One version of the A9home OS is incapable of drawing patterned lines.
Definition at line 45 of file plotters.c.
Referenced by gui_init(), and ro_plot_draw_path().
const struct plotter_table ro_plotters |
RISC OS plotter operation table.
Definition at line 727 of file plotters.c.
Referenced by cookie_draw(), global_history_draw(), hotlist_draw(), print_document(), riscos_bitmap_render(), ro_gui_progress_bar_redraw_window(), ro_gui_status_bar_redraw(), ro_gui_url_bar_redraw(), ro_gui_window__redraw_rect(), ro_local_history_draw(), and ro_pageinfo_draw().