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