NetSurf
|
#include "amiga/os3support.h"
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/layers.h>
#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
#include <graphics/gfxmacros.h>
#include <graphics/gfxbase.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
#include "utils/nsoption.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "netsurf/css.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "amiga/plotters.h"
#include "amiga/bitmap.h"
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/rtg.h"
#include "amiga/utf8.h"
Go to the source code of this file.
Data Structures | |
struct | bfbitmap |
struct | ami_plot_pen |
struct | bez_point |
struct | gui_globals |
Macros | |
#define | M_PI 3.14159265358979323846 |
#define | PATT_DOT 0xAAAA |
#define | PATT_DASH 0xCCCC |
#define | PATT_LINE 0xFFFF |
#define | AREA_SIZE 25000 |
Functions | |
HOOKF (void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *) | |
struct gui_globals * | ami_plot_ra_alloc (ULONG width, ULONG height, bool force32bit, bool alloc_pen_list) |
Alloc a plotter render area. More... | |
void | ami_plot_ra_free (struct gui_globals *gg) |
Free a plotter render area. More... | |
struct RastPort * | ami_plot_ra_get_rastport (struct gui_globals *gg) |
Get RastPort associated with a render area. More... | |
struct BitMap * | ami_plot_ra_get_bitmap (struct gui_globals *gg) |
Get a drawing BitMap associated with a render area. More... | |
void | ami_plot_ra_get_size (struct gui_globals *gg, int *width, int *height) |
Get size of BitMap associated with a render area. More... | |
void | ami_plot_ra_set_pen_list (struct gui_globals *gg, struct MinList *pen_list) |
Set a list of shared pens for a render area to use Only relevant for palette-mapped screens. More... | |
void | ami_clearclipreg (struct gui_globals *gg) |
static ULONG | ami_plot_obtain_pen (struct MinList *shared_pens, ULONG colr) |
void | ami_plot_release_pens (struct MinList *shared_pens) |
static void | ami_plot_setapen (struct gui_globals *glob, struct RastPort *rp, ULONG colr) |
static void | ami_plot_setopen (struct gui_globals *glob, struct RastPort *rp, ULONG colr) |
void | ami_plot_clear_bbox (struct RastPort *rp, struct IBox *bbox) |
static void | ami_arc_gfxlib (struct RastPort *rp, int x, int y, int radius, int angle1, int angle2) |
static nserror | ami_bitmap (struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap) |
static void | ami_bezier (struct bez_point *restrict a, struct bez_point *restrict b, struct bez_point *restrict c, struct bez_point *restrict d, float t, struct bez_point *restrict p) |
bool | ami_plot_screen_is_palettemapped (void) |
static nserror | ami_clip (const struct redraw_context *ctx, const struct rect *clip) |
Sets a clip rectangle for subsequent plot operations. More... | |
static nserror | ami_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 | ami_disc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) |
Plots a circle. More... | |
static nserror | ami_line (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) |
Plots a line. More... | |
static nserror | ami_rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) |
Plots a rectangle. More... | |
static nserror | ami_polygon (const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n) |
Plot a polygon. More... | |
static nserror | ami_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 | ami_bitmap_tile (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 | ami_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 | |
static int | init_layers_count = 0 |
static APTR | pool_pens = NULL |
static bool | palette_mapped = true |
const struct plotter_table | amiplot |
#define AREA_SIZE 25000 |
Definition at line 111 of file plotters.c.
#define M_PI 3.14159265358979323846 |
Definition at line 101 of file plotters.c.
#define PATT_DASH 0xCCCC |
Definition at line 105 of file plotters.c.
#define PATT_DOT 0xAAAA |
Definition at line 104 of file plotters.c.
#define PATT_LINE 0xFFFF |
Definition at line 106 of 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 671 of file plotters.c.
References ami_arc_gfxlib(), ami_plot_setapen(), plot_style_s::fill_colour, NSERROR_OK, NSLOG, redraw_context::priv, and gui_globals::rp.
|
static |
Definition at line 421 of file plotters.c.
References M_PI.
Referenced by ami_arc().
|
static |
Definition at line 602 of file plotters.c.
Referenced by ami_path().
|
static |
Definition at line 449 of file plotters.c.
References ami_bitmap_get_mask(), ami_bitmap_get_native(), ami_bitmap_is_nativebm(), ami_gui_get_screen(), ami_rtg_freebitmap(), amiga_bitmap_get_opaque(), BLITA_MaskPlane, BLITA_UseSrcAlpha, height, MINTERM_SRCMASK, NSERROR_OK, NSLOG, gui_globals::palette_mapped, gui_globals::rect, gui_globals::rp, scrn, and width.
Referenced by ami_bitmap_tile().
|
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 1034 of file plotters.c.
References ami_bitmap(), ami_bitmap_get_mask(), ami_bitmap_get_native(), ami_bitmap_is_nativebm(), ami_rtg_freebitmap(), amiga_bitmap_get_opaque(), bitmap_get_height(), bitmap_get_width(), BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, bfbitmap::bm, bfbitmap::height, height, bfbitmap::mask, NSERROR_OK, NSLOG, bfbitmap::offsetx, bfbitmap::offsety, bfbitmap::palette_mapped, gui_globals::palette_mapped, redraw_context::priv, gui_globals::rect, gui_globals::rp, bfbitmap::width, and width.
void ami_clearclipreg | ( | struct gui_globals * | gg | ) |
Definition at line 311 of file plotters.c.
References ami_gui_get_screen(), gui_globals::apen, gui_globals::apen_num, gui_globals::open, gui_globals::open_num, gui_globals::rect, gui_globals::rp, and scrn.
Referenced by ami_cw_redraw_rect(), ami_do_redraw_tiled(), bitmap_render(), and gui_window_new_content().
|
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 626 of file plotters.c.
References clip(), NSERROR_OK, NSLOG, redraw_context::priv, gui_globals::rect, and gui_globals::rp.
|
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 | x coordinate of circle centre. |
y | y coordinate of circle centre. |
radius | circle radius. |
Definition at line 703 of file plotters.c.
References ami_plot_setapen(), plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, NSLOG, PLOT_OP_TYPE_NONE, redraw_context::priv, gui_globals::rp, plot_style_s::stroke_colour, and plot_style_s::stroke_type.
|
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 |
< Solid colour
< Doted plot
< dashed plot
Definition at line 738 of file plotters.c.
References ami_plot_setapen(), line(), NSERROR_OK, NSLOG, PATT_DASH, PATT_DOT, PATT_LINE, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_SOLID, plot_style_fixed_to_int, redraw_context::priv, gui_globals::rp, 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 896 of file plotters.c.
References ami_bezier(), ami_plot_setapen(), ami_plot_setopen(), plot_style_s::fill_colour, NS_TRANSPARENT, NSERROR_INVALID, NSERROR_OK, NSLOG, PLOTTER_PATH_BEZIER, PLOTTER_PATH_CLOSE, PLOTTER_PATH_LINE, PLOTTER_PATH_MOVE, redraw_context::priv, gui_globals::rp, plot_style_s::stroke_colour, bez_point::x, and bez_point::y.
void ami_plot_clear_bbox | ( | struct RastPort * | rp, |
struct IBox * | bbox | ||
) |
Definition at line 412 of file plotters.c.
Referenced by ami_switch_tab().
|
static |
Definition at line 330 of file plotters.c.
References ami_gui_get_screen(), ami_memory_itempool_alloc, ami_plot_pen::node, NSLOG, ami_plot_pen::pen, pool_pens, and scrn.
Referenced by ami_plot_setapen(), and ami_plot_setopen().
struct gui_globals * ami_plot_ra_alloc | ( | ULONG | width, |
ULONG | height, | ||
bool | force32bit, | ||
bool | alloc_pen_list | ||
) |
Alloc a plotter render area.
width | of render bitmap |
height | of render bitmap |
force32bit | allocate a 32-bit bitmap even if this does not match the screen |
alloc_pen_list | set to false to use own pen list (eg. if multiple pen lists will be required) |
Definition at line 113 of file plotters.c.
References ami_AllocMinList(), ami_gui_get_screen(), ami_memory_chip_alloc, ami_memory_itempool_create, ami_rtg_allocbitmap(), amiga_warn_user(), gui_globals::apen, gui_globals::apen_num, AREA_SIZE, gui_globals::areabuf, BGBACKFILL, BITMAP_LAYOUT_ARGB8888, bitmap_set_format(), gui_globals::bm, gui_globals::height, height, init_layers_count, gui_globals::layerinfo, gui_globals::managed_pen_list, NSLOG, nsoption_bool, nsoption_int, nsoption_set_bool, gui_globals::open, gui_globals::open_num, gui_globals::palette_mapped, palette_mapped, pool_pens, gui_globals::rp, scrn, gui_globals::shared_pens, gui_globals::tmprasbuf, gui_globals::width, and width.
Referenced by ami_corewindow_init(), ami_openscreenfirst(), ami_print_begin(), and bitmap_render().
void ami_plot_ra_free | ( | struct gui_globals * | gg | ) |
Free a plotter render area.
gg | render area to free |
Definition at line 258 of file plotters.c.
References ami_memory_chip_free, ami_memory_itempool_delete, ami_plot_release_pens(), ami_rtg_freebitmap(), gui_globals::areabuf, gui_globals::bm, init_layers_count, gui_globals::layerinfo, gui_globals::managed_pen_list, pool_pens, gui_globals::rp, gui_globals::shared_pens, and gui_globals::tmprasbuf.
Referenced by ami_corewindow_fini(), ami_print_end(), bitmap_render(), and gui_quit().
struct BitMap * ami_plot_ra_get_bitmap | ( | struct gui_globals * | gg | ) |
Get a drawing BitMap associated with a render area.
gg | render area |
Definition at line 295 of file plotters.c.
References gui_globals::bm.
Referenced by ami_cw_redraw_rect(), ami_do_redraw_tiled(), and bitmap_render().
struct RastPort * ami_plot_ra_get_rastport | ( | struct gui_globals * | gg | ) |
Get RastPort associated with a render area.
gg | render area |
Definition at line 290 of file plotters.c.
References gui_globals::rp.
Referenced by ami_print_dump().
void ami_plot_ra_get_size | ( | struct gui_globals * | gg, |
int * | width, | ||
int * | height | ||
) |
Get size of BitMap associated with a render area.
gg | render area |
width | updated to BitMap width |
height | updated to BitMap height |
Definition at line 300 of file plotters.c.
References gui_globals::height, height, gui_globals::width, and width.
Referenced by ami_cw_redraw_rect(), and ami_do_redraw_tiled().
void ami_plot_ra_set_pen_list | ( | struct gui_globals * | gg, |
struct MinList * | pen_list | ||
) |
Set a list of shared pens for a render area to use Only relevant for palette-mapped screens.
gg | render area |
pen_list | allocated by ami_AllocMinList() |
Definition at line 306 of file plotters.c.
References gui_globals::shared_pens.
Referenced by ami_do_redraw_tiled().
void ami_plot_release_pens | ( | struct MinList * | shared_pens | ) |
Definition at line 356 of file plotters.c.
References ami_gui_get_screen(), ami_memory_itempool_free, GetHead(), GetSucc(), IsMinListEmpty, ami_plot_pen::node, pool_pens, and scrn.
Referenced by ami_plot_ra_free(), ami_switch_tab(), gui_window_destroy(), and gui_window_new_content().
bool ami_plot_screen_is_palettemapped | ( | void | ) |
Definition at line 610 of file plotters.c.
References palette_mapped.
Referenced by ami_gui_opts_open(), ami_theme_throbber_setup(), gui_search_web_provider_update(), and gui_window_set_icon().
|
static |
Definition at line 374 of file plotters.c.
References ami_plot_obtain_pen(), gui_globals::apen, gui_globals::apen_num, ns_color_to_nscss, gui_globals::palette_mapped, ami_plot_pen::pen, RPTAG_APenColor, and gui_globals::shared_pens.
Referenced by ami_arc(), ami_disc(), ami_line(), ami_path(), ami_polygon(), ami_rectangle(), and ami_text().
|
static |
Definition at line 393 of file plotters.c.
References ami_plot_obtain_pen(), ns_color_to_nscss, gui_globals::open, gui_globals::open_num, gui_globals::palette_mapped, ami_plot_pen::pen, and gui_globals::shared_pens.
Referenced by ami_path().
|
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 853 of file plotters.c.
References ami_plot_setapen(), plot_style_s::fill_colour, NSERROR_OK, NSLOG, redraw_context::priv, and gui_globals::rp.
|
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 |
< Solid colour
< Dotted plot
< dashed plot
Definition at line 790 of file plotters.c.
References ami_plot_setapen(), plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, NSLOG, PATT_DASH, PATT_DOT, PATT_LINE, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, PLOT_OP_TYPE_SOLID, plot_style_fixed_to_int, redraw_context::priv, gui_globals::rp, 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 1159 of file plotters.c.
References ami_nsfont, ami_plot_setapen(), plot_font_style::foreground, NSERROR_OK, NSLOG, nsoption_bool, redraw_context::priv, gui_globals::rp, text(), and ami_font_functions::text.
HOOKF | ( | void | , |
ami_bitmap_tile_hook | , | ||
struct RastPort * | , | ||
rp | , | ||
struct BackFillMessage * | |||
) |
Definition at line 538 of file plotters.c.
References ami_gui_get_screen(), BLITA_MaskPlane, BLITA_UseSrcAlpha, bfbitmap::bm, bfbitmap::height, bfbitmap::mask, MINTERM_SRCMASK, bfbitmap::offsetx, bfbitmap::offsety, bfbitmap::palette_mapped, scrn, and bfbitmap::width.
const struct plotter_table amiplot |
Definition at line 1180 of file plotters.c.
Referenced by ami_cw_redraw_rect(), ami_do_redraw(), ami_do_redraw_limits(), and bitmap_render().
|
static |
Definition at line 96 of file plotters.c.
Referenced by ami_plot_ra_alloc(), and ami_plot_ra_free().
|
static |
Definition at line 98 of file plotters.c.
Referenced by ami_bitmap_get_native(), ami_plot_ra_alloc(), and ami_plot_screen_is_palettemapped().
|
static |
Definition at line 97 of file plotters.c.
Referenced by ami_plot_obtain_pen(), ami_plot_ra_alloc(), ami_plot_ra_free(), and ami_plot_release_pens().