NetSurf
plotters.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-09, 2012-13 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "amiga/os3support.h"
20
21#include <proto/exec.h>
22#include <proto/intuition.h>
23#include <proto/layers.h>
24#include <proto/graphics.h>
25
26#include <intuition/intuition.h>
27#include <graphics/rpattr.h>
28#include <graphics/gfxmacros.h>
29#include <graphics/gfxbase.h>
30
31#ifdef __amigaos4__
32#include <graphics/blitattr.h>
33#include <graphics/composite.h>
34#endif
35
36#include <math.h>
37#include <assert.h>
38#include <stdlib.h>
39
40#include "utils/nsoption.h"
41#include "utils/utils.h"
42#include "utils/log.h"
43#include "netsurf/css.h"
44#include "netsurf/mouse.h"
45#include "netsurf/window.h"
46
47#include "amiga/plotters.h"
48#include "amiga/bitmap.h"
49#include "amiga/font.h"
50#include "amiga/gui.h"
51#include "amiga/memory.h"
52#include "amiga/misc.h"
53#include "amiga/rtg.h"
54#include "amiga/utf8.h"
55
56HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *);
57
58struct bfbitmap {
59 struct BitMap *bm;
60 ULONG width;
61 ULONG height;
64 APTR mask;
66};
67
69 struct MinNode node;
70 ULONG pen;
71};
72
73struct bez_point {
74 float x;
75 float y;
76};
77
79 struct BitMap *bm;
80 struct RastPort *rp;
81 struct Layer_Info *layerinfo;
82 APTR areabuf;
84 struct Rectangle rect;
85 struct MinList *shared_pens;
88 ULONG apen;
89 ULONG open;
92 int width; /* size of bm and */
93 int height; /* associated memory */
94};
95
96static int init_layers_count = 0;
97static APTR pool_pens = NULL;
98static bool palette_mapped = true; /* palette-mapped state for the screen */
99
100#ifndef M_PI /* For some reason we don't always get this from math.h */
101#define M_PI 3.14159265358979323846
102#endif
103
104#define PATT_DOT 0xAAAA
105#define PATT_DASH 0xCCCC
106#define PATT_LINE 0xFFFF
107
108/* This defines the size of the list for Area* functions.
109 25000 = 5000 vectors
110 */
111#define AREA_SIZE 25000
112
113struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list)
114{
115 /* init shared bitmaps */
116 int depth = 32;
117 struct BitMap *friend = NULL;
118 struct Screen *scrn = ami_gui_get_screen();
119
120 struct gui_globals *gg = malloc(sizeof(struct gui_globals));
121
122 if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
123 NSLOG(netsurf, INFO, "Screen depth = %d", depth);
124
125#ifdef __amigaos4__
126 if(depth < 16) {
127 gg->palette_mapped = true;
128 if(force32bit == false) palette_mapped = true;
129
131 .layout = BITMAP_LAYOUT_ARGB8888,
132 .pma = true,
133 });
134
135 NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
136
137 } else {
138 gg->palette_mapped = false;
139
141 .layout = BITMAP_LAYOUT_ARGB8888,
142 .pma = false,
143 });
144
145 NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
146
147 }
148#else
150 .layout = BITMAP_LAYOUT_ARGB8888,
151 .pma = true,
152 });
153
154 NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
155
156
157 /* Friend BitMaps are weird.
158 * For OS4, we shouldn't use a friend BitMap here (see below).
159 * For OS3 AGA, we get no display blitted if we use a friend BitMap,
160 * however on RTG it seems to be a benefit.
161 */
162 if(nsoption_bool(friend_bitmap) == true) {
163 friend = scrn->RastPort.BitMap;
164 } else {
165 /* Force friend BitMaps on for obvious RTG screens under OS3.
166 * If we get a bit smarter about this we can lose the user option. */
167 if((depth > 8) && (force32bit == false)) friend = scrn->RastPort.BitMap;
168 }
169
170 if(depth < 16) {
171 gg->palette_mapped = true;
172 if(force32bit == false) palette_mapped = true;
173 } else {
174 gg->palette_mapped = false;
175 }
176#endif
177
178 /* Probably need to fix this next line */
179 if(gg->palette_mapped == true) nsoption_set_bool(font_antialiasing, false);
180
181 if(!width) width = nsoption_int(redraw_tile_size_x);
182 if(!height) height = nsoption_int(redraw_tile_size_y);
183 gg->width = width;
184 gg->height = height;
185
186 gg->layerinfo = NewLayerInfo();
187 gg->areabuf = malloc(AREA_SIZE);
188
189 /* OS3/AGA requires this to be in chip mem. RTG would probably rather it wasn't. */
191
192 if(gg->palette_mapped == true) {
193 gg->bm = AllocBitMap(width, height, depth, 0, friend);
194 } else {
195#ifdef __amigaos4__
196 /* Screen depth is reported as 24 even when it's actually 32-bit.
197 * We get freezes and other problems on OS4 if we befriend at any
198 * other depths, hence this check.
199 * \todo use friend BitMaps but avoid CompositeTags() at non-32-bit
200 * as that seems to be the cause of the problems.
201 */
202 if((depth >= 24) && (force32bit == false)) friend = scrn->RastPort.BitMap;
203#endif
204 gg->bm = ami_rtg_allocbitmap(width, height, 32, 0, friend, RGBFB_A8R8G8B8);
205 }
206
207 if(!gg->bm) amiga_warn_user("NoMemory","");
208
209 gg->rp = malloc(sizeof(struct RastPort));
210 if(!gg->rp) amiga_warn_user("NoMemory","");
211
212 InitRastPort(gg->rp);
213 gg->rp->BitMap = gg->bm;
214
215 SetDrMd(gg->rp,BGBACKFILL);
216
217 gg->rp->Layer = CreateUpfrontLayer(gg->layerinfo,gg->rp->BitMap,0,0,
218 width-1, height-1, LAYERSIMPLE, NULL);
219
220 InstallLayerHook(gg->rp->Layer,LAYERS_NOBACKFILL);
221
222 gg->rp->AreaInfo = malloc(sizeof(struct AreaInfo));
223 if((!gg->areabuf) || (!gg->rp->AreaInfo)) amiga_warn_user("NoMemory","");
224
225 InitArea(gg->rp->AreaInfo, gg->areabuf, AREA_SIZE/5);
226
227 gg->rp->TmpRas = malloc(sizeof(struct TmpRas));
228 if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) amiga_warn_user("NoMemory","");
229
230 InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
231
232 gg->shared_pens = NULL;
233 gg->managed_pen_list = false;
234
235 if(gg->palette_mapped == true) {
236 if(pool_pens == NULL) {
238 }
239
240 if(alloc_pen_list == true) {
242 gg->managed_pen_list = true;
243 }
244 }
245
246 gg->apen = 0x00000000;
247 gg->open = 0x00000000;
248 gg->apen_num = -1;
249 gg->open_num = -1;
250
252 NSLOG(netsurf, INFO, "Layer initialised (total: %d)",
254
255 return gg;
256}
257
259{
261
262 if(init_layers_count < 0) return;
263
264 if((init_layers_count == 0) && (pool_pens != NULL)) {
266 pool_pens = NULL;
267 }
268
269 if(gg->rp) {
270 if(gg->rp->Layer != NULL) DeleteLayer(0, gg->rp->Layer);
271 free(gg->rp->TmpRas);
272 free(gg->rp->AreaInfo);
273 free(gg->rp);
274 }
275
277 free(gg->areabuf);
278 DisposeLayerInfo(gg->layerinfo);
279 if(gg->bm) ami_rtg_freebitmap(gg->bm);
280
281 if(gg->managed_pen_list == true) {
283 free(gg->shared_pens);
284 gg->shared_pens = NULL;
285 }
286
287 free(gg);
288}
289
290struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg)
291{
292 return gg->rp;
293}
294
295struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg)
296{
297 return gg->bm;
298}
299
300void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
301{
302 *width = gg->width;
303 *height = gg->height;
304}
305
306void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
307{
308 gg->shared_pens = pen_list;
309}
310
312{
313 struct Region *reg = NULL;
314 struct Screen *scrn = ami_gui_get_screen();
315
316 reg = InstallClipRegion(gg->rp->Layer,NULL);
317 if(reg) DisposeRegion(reg);
318
319 gg->rect.MinX = 0;
320 gg->rect.MinY = 0;
321 gg->rect.MaxX = scrn->Width-1;
322 gg->rect.MaxY = scrn->Height-1;
323
324 gg->apen = 0x00000000;
325 gg->open = 0x00000000;
326 gg->apen_num = -1;
327 gg->open_num = -1;
328}
329
330static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
331{
332 struct ami_plot_pen *node;
333 struct Screen *scrn = ami_gui_get_screen();
334
335 LONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
336 (colr & 0x000000ff) << 24,
337 (colr & 0x0000ff00) << 16,
338 (colr & 0x00ff0000) << 8,
339 NULL);
340
341 if(pen == -1) NSLOG(netsurf, INFO,
342 "WARNING: Cannot allocate pen for ABGR:%lx", colr);
343
344 if((shared_pens != NULL) && (pool_pens != NULL)) {
345 if((node = (struct ami_plot_pen *)ami_memory_itempool_alloc(pool_pens, sizeof(struct ami_plot_pen)))) {
346 node->pen = pen;
347 AddTail((struct List *)shared_pens, (struct Node *)node);
348 }
349 } else {
350 /* Immediately release the pen if we can't keep track of it. */
351 ReleasePen(scrn->ViewPort.ColorMap, pen);
352 }
353 return pen;
354}
355
356void ami_plot_release_pens(struct MinList *shared_pens)
357{
358 struct Screen *scrn = ami_gui_get_screen();
359 struct ami_plot_pen *node;
360 struct ami_plot_pen *nnode;
361
362 if(shared_pens == NULL) return;
363 if(IsMinListEmpty(shared_pens)) return;
364 node = (struct ami_plot_pen *)GetHead((struct List *)shared_pens);
365
366 do {
367 nnode = (struct ami_plot_pen *)GetSucc((struct Node *)node);
368 ReleasePen(scrn->ViewPort.ColorMap, node->pen);
369 Remove((struct Node *)node);
371 } while((node = nnode));
372}
373
374static void ami_plot_setapen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
375{
376 if(glob->apen == colr) return;
377
378#ifdef __amigaos4__
379 if(glob->palette_mapped == false) {
380 SetRPAttrs(rp, RPTAG_APenColor,
381 ns_color_to_nscss(colr),
382 TAG_DONE);
383 } else
384#endif
385 {
386 LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
387 if((pen != -1) && (pen != glob->apen_num)) SetAPen(rp, pen);
388 }
389
390 glob->apen = colr;
391}
392
393static void ami_plot_setopen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
394{
395 if(glob->open == colr) return;
396
397#ifdef __amigaos4__
398 if(glob->palette_mapped == false) {
399 SetRPAttrs(rp, RPTAG_OPenColor,
400 ns_color_to_nscss(colr),
401 TAG_DONE);
402 } else
403#endif
404 {
405 LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
406 if((pen != -1) && (pen != glob->open_num)) SetOPen(rp, pen);
407 }
408
409 glob->open = colr;
410}
411
412void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
413{
414 if((bbox == NULL) || (rp == NULL)) return;
415
416 EraseRect(rp, bbox->Left, bbox->Top,
417 bbox->Width + bbox->Left, bbox->Height + bbox->Top);
418}
419
420
421static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int angle1, int angle2)
422{
423 float angle1_r = (float)(angle1) * (M_PI / 180.0);
424 float angle2_r = (float)(angle2) * (M_PI / 180.0);
425 float angle, b, c;
426 float step = 0.1; //(angle2_r - angle1_r) / ((angle2_r - angle1_r) * (float)radius);
427 int x0, y0, x1, y1;
428
429 x0 = x;
430 y0 = y;
431
432 b = angle1_r;
433 c = angle2_r;
434
435 x1 = (int)(cos(b) * (float)radius);
436 y1 = (int)(sin(b) * (float)radius);
437 Move(rp, x0 + x1, y0 - y1);
438
439 for(angle = (b + step); angle <= c; angle += step) {
440 x1 = (int)(cos(angle) * (float)radius);
441 y1 = (int)(sin(angle) * (float)radius);
442 Draw(rp, x0 + x1, y0 - y1);
443 }
444}
445
446/**
447 */
448static nserror
449ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap)
450{
451 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()");
452 struct Screen *scrn = ami_gui_get_screen();
453 struct BitMap *tbm;
454
455 if (!width || !height) {
456 return NSERROR_OK;
457 }
458
459 if (((x + width) < glob->rect.MinX) ||
460 ((y + height) < glob->rect.MinY) ||
461 (x > glob->rect.MaxX) ||
462 (y > glob->rect.MaxY)) {
463 return NSERROR_OK;
464 }
465
466 tbm = ami_bitmap_get_native(bitmap, width, height, glob->palette_mapped, glob->rp->BitMap);
467 if (!tbm) {
468 return NSERROR_OK;
469 }
470
471 NSLOG(plot, DEEPDEBUG, "[ami_plotter] ami_bitmap() got native bitmap");
472
473#ifdef __amigaos4__
474 if (__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
475 (glob->palette_mapped == false), 1)) {
476 uint32 comptype = COMPOSITE_Src_Over_Dest;
477 uint32 compflags = COMPFLAG_IgnoreDestAlpha;
479 compflags |= COMPFLAG_SrcAlphaOverride;
480 comptype = COMPOSITE_Src;
481 }
482
483 CompositeTags(comptype,tbm,glob->rp->BitMap,
484 COMPTAG_Flags, compflags,
485 COMPTAG_DestX,glob->rect.MinX,
486 COMPTAG_DestY,glob->rect.MinY,
487 COMPTAG_DestWidth,glob->rect.MaxX - glob->rect.MinX + 1,
488 COMPTAG_DestHeight,glob->rect.MaxY - glob->rect.MinY + 1,
489 COMPTAG_SrcWidth,width,
490 COMPTAG_SrcHeight,height,
491 COMPTAG_OffsetX,x,
492 COMPTAG_OffsetY,y,
493 COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
494 TAG_DONE);
495 } else
496#endif
497 {
498 ULONG tag, tag_data, minterm = 0xc0;
499
500 if (glob->palette_mapped == false) {
501 tag = BLITA_UseSrcAlpha;
502 tag_data = !amiga_bitmap_get_opaque(bitmap);
503 minterm = 0xc0;
504 } else {
505 tag = BLITA_MaskPlane;
506 if ((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm)))
507 minterm = MINTERM_SRCMASK;
508 }
509#ifdef __amigaos4__
510 BltBitMapTags(BLITA_Width,width,
511 BLITA_Height,height,
512 BLITA_Source,tbm,
513 BLITA_Dest,glob->rp,
514 BLITA_DestX,x,
515 BLITA_DestY,y,
516 BLITA_SrcType,BLITT_BITMAP,
517 BLITA_DestType,BLITT_RASTPORT,
518 BLITA_Minterm, minterm,
519 tag, tag_data,
520 TAG_DONE);
521#else
522 if (tag_data) {
523 BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, minterm, tag_data);
524 } else {
525 BltBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, 0xc0);
526 }
527#endif
528 }
529
530 if ((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
532 }
533
534 return NSERROR_OK;
535}
536
537
538HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *)
539{
540 int xf,yf;
541 struct bfbitmap *bfbm = (struct bfbitmap *)hook->h_Data;
542 struct Screen *scrn = ami_gui_get_screen();
543
544 /* tile down and across to extents (msg->Bounds.MinX)*/
545 for (xf = -bfbm->offsetx; xf < msg->Bounds.MaxX; xf += bfbm->width) {
546 for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) {
547#ifdef __amigaos4__
548 if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
549 (bfbm->palette_mapped == false), 1)) {
550 CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
551 COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
552 COMPTAG_DestX, msg->Bounds.MinX,
553 COMPTAG_DestY, msg->Bounds.MinY,
554 COMPTAG_DestWidth, msg->Bounds.MaxX - msg->Bounds.MinX + 1,
555 COMPTAG_DestHeight, msg->Bounds.MaxY - msg->Bounds.MinY + 1,
556 COMPTAG_SrcWidth, bfbm->width,
557 COMPTAG_SrcHeight, bfbm->height,
558 COMPTAG_OffsetX, xf,
559 COMPTAG_OffsetY, yf,
560 COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
561 TAG_DONE);
562 } else
563#endif
564 {
565 ULONG tag, tag_data, minterm = 0xc0;
566
567 if(bfbm->palette_mapped == false) {
568 tag = BLITA_UseSrcAlpha;
569 tag_data = TRUE;
570 minterm = 0xc0;
571 } else {
572 tag = BLITA_MaskPlane;
573 if((tag_data = (ULONG)bfbm->mask))
574 minterm = MINTERM_SRCMASK;
575 }
576#ifdef __amigaos4__
577 BltBitMapTags(BLITA_Width, bfbm->width,
578 BLITA_Height, bfbm->height,
579 BLITA_Source, bfbm->bm,
580 BLITA_Dest, rp,
581 BLITA_DestX, xf,
582 BLITA_DestY, yf,
583 BLITA_SrcType, BLITT_BITMAP,
584 BLITA_DestType, BLITT_RASTPORT,
585 BLITA_Minterm, minterm,
586 tag, tag_data,
587 TAG_DONE);
588#else
589 if(tag_data) {
590 BltMaskBitMapRastPort(bfbm->bm, 0, 0, rp, xf, yf,
591 bfbm->width, bfbm->height, minterm, tag_data);
592 } else {
593 BltBitMapRastPort(bfbm->bm, 0, 0, rp, xf, yf,
594 bfbm->width, bfbm->height, minterm);
595 }
596#endif
597 }
598 }
599 }
600}
601
602static void ami_bezier(struct bez_point *restrict a, struct bez_point *restrict b,
603 struct bez_point *restrict c, struct bez_point *restrict d,
604 float t, struct bez_point *restrict p) {
605 p->x = pow((1 - t), 3) * a->x + 3 * t * pow((1 -t), 2) * b->x + 3 * (1-t) * pow(t, 2)* c->x + pow (t, 3)* d->x;
606 p->y = pow((1 - t), 3) * a->y + 3 * t * pow((1 -t), 2) * b->y + 3 * (1-t) * pow(t, 2)* c->y + pow (t, 3)* d->y;
607}
608
609
611{
612 /* This may not be entirely correct - previously we returned the state of the current BitMap */
613 return palette_mapped;
614}
615
616
617/**
618 * \brief Sets a clip rectangle for subsequent plot operations.
619 *
620 * \param ctx The current redraw context.
621 * \param clip The rectangle to limit all subsequent plot
622 * operations within.
623 * \return NSERROR_OK on success else error code.
624 */
625static nserror
626ami_clip(const struct redraw_context *ctx, const struct rect *clip)
627{
628 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
629 struct Region *reg = NULL;
630
631 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_clip()");
632
633 if (glob->rp->Layer) {
634 reg = NewRegion();
635
636 glob->rect.MinX = clip->x0;
637 glob->rect.MinY = clip->y0;
638 glob->rect.MaxX = clip->x1-1;
639 glob->rect.MaxY = clip->y1-1;
640
641 OrRectRegion(reg,&glob->rect);
642
643 reg = InstallClipRegion(glob->rp->Layer,reg);
644
645 if(reg) {
646 DisposeRegion(reg);
647 }
648 }
649
650 return NSERROR_OK;
651}
652
653
654/**
655 * Plots an arc
656 *
657 * plot an arc segment around (x,y), anticlockwise from angle1
658 * to angle2. Angles are measured anticlockwise from
659 * horizontal, in degrees.
660 *
661 * \param ctx The current redraw context.
662 * \param style Style controlling the arc plot.
663 * \param x The x coordinate of the arc.
664 * \param y The y coordinate of the arc.
665 * \param radius The radius of the arc.
666 * \param angle1 The start angle of the arc.
667 * \param angle2 The finish angle of the arc.
668 * \return NSERROR_OK on success else error code.
669 */
670static nserror
671ami_arc(const struct redraw_context *ctx,
672 const plot_style_t *style,
673 int x, int y, int radius, int angle1, int angle2)
674{
675 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_arc()");
676
677 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
678
679 if (angle2 < angle1) {
680 angle2 += 360;
681 }
682
683 ami_plot_setapen(glob, glob->rp, style->fill_colour);
684 ami_arc_gfxlib(glob->rp, x, y, radius, angle1, angle2);
685
686 return NSERROR_OK;
687}
688
689
690/**
691 * Plots a circle
692 *
693 * Plot a circle centered on (x,y), which is optionally filled.
694 *
695 * \param ctx The current redraw context.
696 * \param style Style controlling the circle plot.
697 * \param x x coordinate of circle centre.
698 * \param y y coordinate of circle centre.
699 * \param radius circle radius.
700 * \return NSERROR_OK on success else error code.
701 */
702static nserror
703ami_disc(const struct redraw_context *ctx,
704 const plot_style_t *style,
705 int x, int y, int radius)
706{
707 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_disc()");
708
709 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
710
711 if (style->fill_type != PLOT_OP_TYPE_NONE) {
712 ami_plot_setapen(glob, glob->rp, style->fill_colour);
713 AreaCircle(glob->rp,x,y,radius);
714 AreaEnd(glob->rp);
715 }
716
717 if (style->stroke_type != PLOT_OP_TYPE_NONE) {
718 ami_plot_setapen(glob, glob->rp, style->stroke_colour);
719 DrawEllipse(glob->rp,x,y,radius,radius);
720 }
721
722 return NSERROR_OK;
723}
724
725
726/**
727 * Plots a line
728 *
729 * plot a line from (x0,y0) to (x1,y1). Coordinates are at
730 * centre of line width/thickness.
731 *
732 * \param ctx The current redraw context.
733 * \param style Style controlling the line plot.
734 * \param line A rectangle defining the line to be drawn
735 * \return NSERROR_OK on success else error code.
736 */
737static nserror
738ami_line(const struct redraw_context *ctx,
739 const plot_style_t *style,
740 const struct rect *line)
741{
742 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_line()");
743
744 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
745
746 glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
747 glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
748
749 switch (style->stroke_type) {
750 case PLOT_OP_TYPE_SOLID: /**< Solid colour */
751 default:
752 glob->rp->LinePtrn = PATT_LINE;
753 break;
754
755 case PLOT_OP_TYPE_DOT: /**< Doted plot */
756 glob->rp->LinePtrn = PATT_DOT;
757 break;
758
759 case PLOT_OP_TYPE_DASH: /**< dashed plot */
760 glob->rp->LinePtrn = PATT_DASH;
761 break;
762 }
763
764 ami_plot_setapen(glob, glob->rp, style->stroke_colour);
765 Move(glob->rp, line->x0, line->y0);
766 Draw(glob->rp, line->x1, line->y1);
767
768 glob->rp->PenWidth = 1;
769 glob->rp->PenHeight = 1;
770 glob->rp->LinePtrn = PATT_LINE;
771
772 return NSERROR_OK;
773}
774
775
776/**
777 * Plots a rectangle.
778 *
779 * The rectangle can be filled an outline or both controlled
780 * by the plot style The line can be solid, dotted or
781 * dashed. Top left corner at (x0,y0) and rectangle has given
782 * width and height.
783 *
784 * \param ctx The current redraw context.
785 * \param style Style controlling the rectangle plot.
786 * \param rect A rectangle defining the line to be drawn
787 * \return NSERROR_OK on success else error code.
788 */
789static nserror
791 const plot_style_t *style,
792 const struct rect *rect)
793{
794 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_rectangle()");
795
796 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
797
798 if (style->fill_type != PLOT_OP_TYPE_NONE) {
799 ami_plot_setapen(glob, glob->rp, style->fill_colour);
800 RectFill(glob->rp, rect->x0, rect->y0, rect->x1- 1 , rect->y1 - 1);
801 }
802
803 if (style->stroke_type != PLOT_OP_TYPE_NONE) {
804 glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
805 glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
806
807 switch (style->stroke_type) {
808 case PLOT_OP_TYPE_SOLID: /**< Solid colour */
809 default:
810 glob->rp->LinePtrn = PATT_LINE;
811 break;
812
813 case PLOT_OP_TYPE_DOT: /**< Dotted plot */
814 glob->rp->LinePtrn = PATT_DOT;
815 break;
816
817 case PLOT_OP_TYPE_DASH: /**< dashed plot */
818 glob->rp->LinePtrn = PATT_DASH;
819 break;
820 }
821
822 ami_plot_setapen(glob, glob->rp, style->stroke_colour);
823 Move(glob->rp, rect->x0, rect->y0);
824 Draw(glob->rp, rect->x1, rect->y0);
825 Draw(glob->rp, rect->x1, rect->y1);
826 Draw(glob->rp, rect->x0, rect->y1);
827 Draw(glob->rp, rect->x0, rect->y0);
828
829 glob->rp->PenWidth = 1;
830 glob->rp->PenHeight = 1;
831 glob->rp->LinePtrn = PATT_LINE;
832 }
833
834 return NSERROR_OK;
835}
836
837
838/**
839 * Plot a polygon
840 *
841 * Plots a filled polygon with straight lines between
842 * points. The lines around the edge of the ploygon are not
843 * plotted. The polygon is filled with the non-zero winding
844 * rule.
845 *
846 * \param ctx The current redraw context.
847 * \param style Style controlling the polygon plot.
848 * \param p verticies of polygon
849 * \param n number of verticies.
850 * \return NSERROR_OK on success else error code.
851 */
852static nserror
853ami_polygon(const struct redraw_context *ctx,
854 const plot_style_t *style,
855 const int *p,
856 unsigned int n)
857{
858 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_polygon()");
859
860 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
861
862 ami_plot_setapen(glob, glob->rp, style->fill_colour);
863
864 if (AreaMove(glob->rp,p[0],p[1]) == -1) {
865 NSLOG(netsurf, INFO, "AreaMove: vector list full");
866 }
867
868 for (uint32 k = 1; k < n; k++) {
869 if (AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) {
870 NSLOG(netsurf, INFO, "AreaDraw: vector list full");
871 }
872 }
873
874 if (AreaEnd(glob->rp) == -1) {
875 NSLOG(netsurf, INFO, "AreaEnd: error");
876 }
877
878 return NSERROR_OK;
879}
880
881
882/**
883 * Plots a path.
884 *
885 * Path plot consisting of cubic Bezier curves. Line and fill colour is
886 * controlled by the plot style.
887 *
888 * \param ctx The current redraw context.
889 * \param pstyle Style controlling the path plot.
890 * \param p elements of path
891 * \param n nunber of elements on path
892 * \param transform A transform to apply to the path.
893 * \return NSERROR_OK on success else error code.
894 */
895static nserror
896ami_path(const struct redraw_context *ctx,
897 const plot_style_t *pstyle,
898 const float *p,
899 unsigned int n,
900 const float transform[6])
901{
902 unsigned int i;
903 struct bez_point start_p = {0, 0}, cur_p = {0, 0}, p_a, p_b, p_c, p_r;
904
905 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_path()");
906
907 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
908
909 if (n == 0) {
910 return NSERROR_OK;
911 }
912
913 if (p[0] != PLOTTER_PATH_MOVE) {
914 NSLOG(netsurf, INFO, "Path does not start with move");
915 return NSERROR_INVALID;
916 }
917
918 if (pstyle->fill_colour != NS_TRANSPARENT) {
919 ami_plot_setapen(glob, glob->rp, pstyle->fill_colour);
920 if (pstyle->stroke_colour != NS_TRANSPARENT) {
921 ami_plot_setopen(glob, glob->rp, pstyle->stroke_colour);
922 }
923 } else {
924 if (pstyle->stroke_colour != NS_TRANSPARENT) {
925 ami_plot_setapen(glob, glob->rp, pstyle->stroke_colour);
926 } else {
927 return NSERROR_OK; /* wholly transparent */
928 }
929 }
930
931 /* Construct path */
932 for (i = 0; i < n; ) {
933 if (p[i] == PLOTTER_PATH_MOVE) {
934 if (pstyle->fill_colour != NS_TRANSPARENT) {
935 if (AreaMove(glob->rp, p[i+1], p[i+2]) == -1) {
936 NSLOG(netsurf, INFO,
937 "AreaMove: vector list full");
938 }
939 } else {
940 Move(glob->rp, p[i+1], p[i+2]);
941 }
942 /* Keep track for future Bezier curves/closes etc */
943 start_p.x = p[i+1];
944 start_p.y = p[i+2];
945 cur_p.x = start_p.x;
946 cur_p.y = start_p.y;
947 i += 3;
948 } else if (p[i] == PLOTTER_PATH_CLOSE) {
949 if (pstyle->fill_colour != NS_TRANSPARENT) {
950 if (AreaEnd(glob->rp) == -1) {
951 NSLOG(netsurf, INFO, "AreaEnd: error");
952 }
953 } else {
954 Draw(glob->rp, start_p.x, start_p.y);
955 }
956 i++;
957 } else if (p[i] == PLOTTER_PATH_LINE) {
958 if (pstyle->fill_colour != NS_TRANSPARENT) {
959 if (AreaDraw(glob->rp, p[i+1], p[i+2]) == -1) {
960 NSLOG(netsurf, INFO,
961 "AreaDraw: vector list full");
962 }
963 } else {
964 Draw(glob->rp, p[i+1], p[i+2]);
965 }
966 cur_p.x = p[i+1];
967 cur_p.y = p[i+2];
968 i += 3;
969 } else if (p[i] == PLOTTER_PATH_BEZIER) {
970 p_a.x = p[i+1];
971 p_a.y = p[i+2];
972 p_b.x = p[i+3];
973 p_b.y = p[i+4];
974 p_c.x = p[i+5];
975 p_c.y = p[i+6];
976
977 for (float t = 0.0; t <= 1.0; t += 0.1) {
978 ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r);
979 if (pstyle->fill_colour != NS_TRANSPARENT) {
980 if (AreaDraw(glob->rp, p_r.x, p_r.y) == -1) {
981 NSLOG(netsurf, INFO,
982 "AreaDraw: vector list full");
983 }
984 } else {
985 Draw(glob->rp, p_r.x, p_r.y);
986 }
987 }
988 cur_p.x = p_c.x;
989 cur_p.y = p_c.y;
990 i += 7;
991 } else {
992 NSLOG(netsurf, INFO, "bad path command %f", p[i]);
993 /* End path for safety if using Area commands */
994 if (pstyle->fill_colour != NS_TRANSPARENT) {
995 AreaEnd(glob->rp);
996 BNDRYOFF(glob->rp);
997 }
998 return NSERROR_INVALID;
999 }
1000 }
1001 if (pstyle->fill_colour != NS_TRANSPARENT) {
1002 BNDRYOFF(glob->rp);
1003 }
1004
1005 return NSERROR_OK;
1006}
1007
1008
1009/**
1010 * Plot a bitmap
1011 *
1012 * Tiled plot of a bitmap image. (x,y) gives the top left
1013 * coordinate of an explicitly placed tile. From this tile the
1014 * image can repeat in all four directions -- up, down, left
1015 * and right -- to the extents given by the current clip
1016 * rectangle.
1017 *
1018 * The bitmap_flags say whether to tile in the x and y
1019 * directions. If not tiling in x or y directions, the single
1020 * image is plotted. The width and height give the dimensions
1021 * the image is to be scaled to.
1022 *
1023 * \param ctx The current redraw context.
1024 * \param bitmap The bitmap to plot
1025 * \param x The x coordinate to plot the bitmap
1026 * \param y The y coordiante to plot the bitmap
1027 * \param width The width of area to plot the bitmap into
1028 * \param height The height of area to plot the bitmap into
1029 * \param bg the background colour to alpha blend into
1030 * \param flags the flags controlling the type of plot operation
1031 * \return NSERROR_OK on success else error code.
1032 */
1033static nserror
1035 struct bitmap *bitmap,
1036 int x, int y,
1037 int width,
1038 int height,
1039 colour bg,
1040 bitmap_flags_t flags)
1041{
1042 int xf,yf,xm,ym,oy,ox;
1043 struct BitMap *tbm = NULL;
1044 struct Hook *bfh = NULL;
1045 struct bfbitmap bfbm;
1046 bool repeat_x = (flags & BITMAPF_REPEAT_X);
1047 bool repeat_y = (flags & BITMAPF_REPEAT_Y);
1048
1049 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap_tile()");
1050
1051 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
1052
1053 if ((width == 0) || (height == 0)) {
1054 return NSERROR_OK;
1055 }
1056
1057 if (!(repeat_x || repeat_y)) {
1058 return ami_bitmap(glob, x, y, width, height, bitmap);
1059 }
1060
1061 /* If it is a one pixel transparent image, we are wasting our time */
1062 if ((amiga_bitmap_get_opaque(bitmap) == false) &&
1063 (bitmap_get_width(bitmap) == 1) &&
1064 (bitmap_get_height(bitmap) == 1)) {
1065 return NSERROR_OK;
1066 }
1067
1068 tbm = ami_bitmap_get_native(bitmap, width, height, glob->palette_mapped, glob->rp->BitMap);
1069 if (!tbm) {
1070 return NSERROR_OK;
1071 }
1072
1073 ox = x;
1074 oy = y;
1075
1076 /* get left most tile position */
1077 for (; ox > 0; ox -= width)
1078
1079 /* get top most tile position */
1080 for (; oy > 0; oy -= height);
1081
1082 if (ox < 0) {
1083 ox = -ox;
1084 }
1085 if (oy < 0) {
1086 oy = -oy;
1087 }
1088 if (repeat_x) {
1089 xf = glob->rect.MaxX;
1090 xm = glob->rect.MinX;
1091 } else {
1092 xf = x + width;
1093 xm = x;
1094 }
1095
1096 if (repeat_y) {
1097 yf = glob->rect.MaxY;
1098 ym = glob->rect.MinY;
1099 } else {
1100 yf = y + height;
1101 ym = y;
1102 }
1103#ifdef __amigaos4__
1105 bfh = CreateBackFillHook(BFHA_BitMap,tbm,
1106 BFHA_Width,width,
1107 BFHA_Height,height,
1108 BFHA_OffsetX,ox,
1109 BFHA_OffsetY,oy,
1110 TAG_DONE);
1111 } else
1112#endif
1113 {
1114 bfbm.bm = tbm;
1115 bfbm.width = width;
1116 bfbm.height = height;
1117 bfbm.offsetx = ox;
1118 bfbm.offsety = oy;
1120 bfbm.palette_mapped = glob->palette_mapped;
1121 bfh = calloc(1, sizeof(struct Hook));
1122 bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
1123 bfh->h_SubEntry = 0;
1124 bfh->h_Data = &bfbm;
1125 }
1126
1127 InstallLayerHook(glob->rp->Layer,bfh);
1128 EraseRect(glob->rp,xm,ym,xf,yf);
1129 InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
1130
1131#ifdef __amigaos4__
1133 DeleteBackFillHook(bfh);
1134 } else
1135#endif
1136 free(bfh);
1137
1138 if ((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
1139 /**\todo is this logic logical? */
1140 ami_rtg_freebitmap(tbm);
1141 }
1142
1143 return NSERROR_OK;
1144}
1145
1146
1147/**
1148 * Text plotting.
1149 *
1150 * \param ctx The current redraw context.
1151 * \param fstyle plot style for this text
1152 * \param x x coordinate
1153 * \param y y coordinate
1154 * \param text UTF-8 string to plot
1155 * \param length length of string, in bytes
1156 * \return NSERROR_OK on success else error code.
1157 */
1158static nserror
1159ami_text(const struct redraw_context *ctx,
1160 const struct plot_font_style *fstyle,
1161 int x,
1162 int y,
1163 const char *text,
1164 size_t length)
1165{
1166 NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_text()");
1167
1168 struct gui_globals *glob = (struct gui_globals *)ctx->priv;
1169
1170 if (__builtin_expect(ami_nsfont == NULL, 0)) {
1171 return NSERROR_OK;
1172 }
1173 ami_plot_setapen(glob, glob->rp, fstyle->foreground);
1174 ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing));
1175
1176 return NSERROR_OK;
1177}
1178
1179
1180const struct plotter_table amiplot = {
1182 .line = ami_line,
1183 .polygon = ami_polygon,
1184 .clip = ami_clip,
1185 .text = ami_text,
1186 .disc = ami_disc,
1187 .arc = ami_arc,
1188 .bitmap = ami_bitmap_tile,
1189 .path = ami_path,
1190 .option_knockout = true,
1191};
1192
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
Definition: gui.c:403
static struct Screen * scrn
Definition: gui.c:326
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
Definition: misc.c:79
const struct plotter_table amiplot
Definition: plotters.c:1180
bool ami_plot_screen_is_palettemapped(void)
Definition: plotters.c:610
#define PATT_LINE
Definition: plotters.c:106
void ami_plot_ra_free(struct gui_globals *gg)
Free a plotter render area.
Definition: plotters.c:258
static nserror ami_disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius)
Plots a circle.
Definition: plotters.c:703
struct BitMap * ami_plot_ra_get_bitmap(struct gui_globals *gg)
Get a drawing BitMap associated with a render area.
Definition: plotters.c:295
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
Definition: plotters.c:412
#define PATT_DASH
Definition: plotters.c:105
static bool palette_mapped
Definition: plotters.c:98
HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *)
Definition: plotters.c:538
static APTR pool_pens
Definition: plotters.c:97
static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
Definition: plotters.c:330
static nserror ami_polygon(const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n)
Plot a polygon.
Definition: plotters.c:853
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.
Definition: plotters.c:671
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)
Definition: plotters.c:602
struct RastPort * ami_plot_ra_get_rastport(struct gui_globals *gg)
Get RastPort associated with a render area.
Definition: plotters.c:290
static nserror ami_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect)
Plots a rectangle.
Definition: plotters.c:790
static nserror ami_line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
Definition: plotters.c:738
#define PATT_DOT
Definition: plotters.c:104
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.
Definition: plotters.c:306
void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
Get size of BitMap associated with a render area.
Definition: plotters.c:300
static void ami_plot_setopen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
Definition: plotters.c:393
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.
Definition: plotters.c:896
static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int angle1, int angle2)
Definition: plotters.c:421
static void ami_plot_setapen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
Definition: plotters.c:374
void ami_clearclipreg(struct gui_globals *gg)
Definition: plotters.c:311
static int init_layers_count
Definition: plotters.c:96
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.
Definition: plotters.c:1159
struct gui_globals * ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list)
Alloc a plotter render area.
Definition: plotters.c:113
#define M_PI
Definition: plotters.c:101
static nserror ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap)
Definition: plotters.c:449
void ami_plot_release_pens(struct MinList *shared_pens)
Definition: plotters.c:356
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.
Definition: plotters.c:1034
static nserror ami_clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plotters.c:626
#define AREA_SIZE
Definition: plotters.c:111
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_INVALID
Invalid data.
Definition: errors.h:49
@ NSERROR_OK
No error.
Definition: errors.h:30
struct BitMap * ami_bitmap_get_native(struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm)
Definition: bitmap.c:666
int bitmap_get_width(void *bitmap)
get width of a bitmap.
Definition: bitmap.c:319
int bitmap_get_height(void *bitmap)
get height of a bitmap.
Definition: bitmap.c:336
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height, struct BitMap *n_bm)
Definition: bitmap.c:626
bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
Test if a BitMap is owned by a bitmap.
Definition: bitmap.c:757
bool amiga_bitmap_get_opaque(void *bitmap)
Gets whether a bitmap should be plotted opaque.
Definition: bitmap.c:309
const struct ami_font_functions * ami_nsfont
Definition: font.h:58
struct MinList * ami_AllocMinList(void)
List abstraction as OS3 appears to have problems with NewMinList()
Definition: object.c:63
void bitmap_set_format(const bitmap_fmt_t *bitmap_format)
Set client bitmap format.
Definition: bitmap.c:118
@ BITMAP_LAYOUT_ARGB8888
32-bit ARGB (0xAARRGGBB).
Definition: bitmap.h:83
Netsurf core css API.
#define ns_color_to_nscss(c)
Convert a NetSurf color to a CSS colour primitive.
Definition: css.h:50
Core mouse and pointer states.
#define BITMAPF_REPEAT_X
Definition: plotters.h:38
#define BITMAPF_REPEAT_Y
Definition: plotters.h:39
unsigned long bitmap_flags_t
Definition: plotters.h:36
@ PLOTTER_PATH_MOVE
Definition: plotters.h:42
@ PLOTTER_PATH_CLOSE
Definition: plotters.h:43
@ PLOTTER_PATH_LINE
Definition: plotters.h:44
@ PLOTTER_PATH_BEZIER
Definition: plotters.h:45
Interface to platform-specific graphical user interface window operations.
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
#define ami_memory_chip_free(p)
Definition: memory.h:30
#define ami_memory_chip_alloc(s)
Definition: memory.h:29
#define ami_memory_itempool_create(s)
Definition: memory.h:54
#define ami_memory_itempool_alloc(p, s)
Definition: memory.h:56
#define ami_memory_itempool_free(p, i, s)
Definition: memory.h:57
#define ami_memory_itempool_delete(p)
Definition: memory.h:55
struct Node * GetHead(struct List *list)
Definition: os3support.c:364
struct Node * GetSucc(struct Node *node)
Definition: os3support.c:381
Minimal compatibility header for AmigaOS 3.
#define MINTERM_SRCMASK
Definition: os3support.h:139
#define RPTAG_APenColor
Definition: os3support.h:76
#define BLITA_UseSrcAlpha
Definition: os3support.h:67
#define BLITA_MaskPlane
Definition: os3support.h:68
#define IsMinListEmpty(L)
Definition: os3support.h:54
uint32_t uint32
Definition: os3support.h:184
#define BGBACKFILL
Definition: os3support.h:124
#define plot_style_fixed_to_int(v)
Definition: plot_style.h:54
@ PLOT_OP_TYPE_NONE
No operation.
Definition: plot_style.h:66
@ PLOT_OP_TYPE_DASH
Dashed plot.
Definition: plot_style.h:69
@ PLOT_OP_TYPE_DOT
Dotted plot.
Definition: plot_style.h:68
@ PLOT_OP_TYPE_SOLID
Solid colour.
Definition: plot_style.h:67
#define NS_TRANSPARENT
Transparent colour value.
Definition: plot_style.h:39
int width
Definition: gui.c:159
int height
Definition: gui.c:160
void ami_rtg_freebitmap(struct BitMap *bm)
Definition: rtg.c:35
struct BitMap * ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap *friend, RGBFTYPE format)
Definition: rtg.c:25
Abstract RTG functions for newer/older/non-P96 systems.
ULONG(* text)(struct RastPort *rp, const char *string, ULONG length, const plot_font_style_t *fstyle, ULONG x, ULONG y, bool aa)
Definition: font.h:53
struct MinNode node
Definition: plotters.c:69
ULONG pen
Definition: plotters.c:70
float y
Definition: plotters.c:75
float x
Definition: plotters.c:74
APTR mask
Definition: plotters.c:64
int offsetx
Definition: plotters.c:62
ULONG height
Definition: plotters.c:61
int offsety
Definition: plotters.c:63
bool palette_mapped
Definition: plotters.c:65
struct BitMap * bm
Definition: plotters.c:59
ULONG width
Definition: plotters.c:60
Bitmap format specifier.
Definition: bitmap.h:95
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
struct MinList * shared_pens
Definition: plotters.c:85
APTR areabuf
Definition: plotters.c:82
APTR tmprasbuf
Definition: plotters.c:83
LONG open_num
Definition: plotters.c:91
int height
Definition: plotters.c:93
ULONG open
Definition: plotters.c:89
struct BitMap * bm
Definition: plotters.c:79
bool managed_pen_list
Definition: plotters.c:86
ULONG apen
Definition: plotters.c:88
struct Rectangle rect
Definition: plotters.c:84
int width
Definition: plotters.c:92
struct Layer_Info * layerinfo
Definition: plotters.c:81
LONG apen_num
Definition: plotters.c:90
bool palette_mapped
Definition: plotters.c:87
struct RastPort * rp
Definition: plotters.c:80
Font style for plotting.
Definition: plot_style.h:111
colour foreground
Colour of text.
Definition: plot_style.h:123
Plot style for stroke/fill plotters.
Definition: plot_style.h:76
colour fill_colour
Colour of fill.
Definition: plot_style.h:81
plot_style_fixed stroke_width
Width of stroke, in pixels.
Definition: plot_style.h:78
plot_operation_type_t fill_type
Fill plot type.
Definition: plot_style.h:80
colour stroke_colour
Colour of stroke.
Definition: plot_style.h:79
plot_operation_type_t stroke_type
Stroke plot type.
Definition: plot_style.h:77
Plotter operations table.
Definition: plotters.h:102
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
Definition: plotters.h:188
Rectangle coordinates.
Definition: types.h:40
int x0
Definition: types.h:41
int y0
Top left.
Definition: types.h:41
int x1
Definition: types.h:42
int y1
Bottom right.
Definition: types.h:42
Redraw context.
Definition: plotters.h:51
void * priv
Private context.
Definition: plotters.h:81
uint32_t colour
Colour type: XBGR.
Definition: types.h:35
Option reading and saving interface.
#define nsoption_int(OPTION)
Get the value of an integer option.
Definition: nsoption.h:279
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
Definition: nsoption.h:310
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:270
Interface to a number of general purpose functionality.
static nserror line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
Definition: plot.c:579
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plot.c:978
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357