summaryrefslogtreecommitdiff
path: root/amiga/plotters.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-07 18:44:28 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-07 18:44:28 +0000
commit394263bb2f81ce0d330058468496ecfa387ca60e (patch)
tree99919fd7a679b1e1eba9fe4ae1d0d1ff6b5bc23e /amiga/plotters.c
parent15eb877a4c6b002968db7fce279d7ad093e4d121 (diff)
downloadnetsurf-394263bb2f81ce0d330058468496ecfa387ca60e.tar.gz
netsurf-394263bb2f81ce0d330058468496ecfa387ca60e.tar.bz2
Basic plotter functions and support code for the plotters.
svn path=/trunk/netsurf/; revision=4948
Diffstat (limited to 'amiga/plotters.c')
-rwxr-xr-xamiga/plotters.c111
1 files changed, 103 insertions, 8 deletions
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 12e7a15b3..0abbfd0e6 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -20,7 +20,11 @@
#include "amiga/gui.h"
#include "amiga/bitmap.h"
#include <proto/Picasso96API.h>
+#include <proto/graphics.h>
#include <intuition/intuition.h>
+#include <graphics/rpattr.h>
+
+static clipx,clipy;
struct plotter_table plot;
const struct plotter_table amiplot = {
@@ -35,54 +39,133 @@ const struct plotter_table amiplot = {
ami_arc,
ami_bitmap,
ami_bitmap_tile,
- ami_group_start,
- ami_group_end,
- ami_flush,
+ NULL, //ami_group_start,
+ NULL, //ami_group_end,
+ ami_flush, // optional
ami_path
};
bool ami_clg(colour c)
{
- printf("clg\n");
+ printf("clg %lx\n",c);
+
+ p96RectFill(currp,0,0,clipx,clipy,
+ p96EncodeColor(RGBFB_A8B8G8R8,c));
+
+ return true;
}
bool ami_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
printf("rect\n");
+ return true;
}
bool ami_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
printf("line\n");
+ SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ TAG_DONE);
+ Move(currp,x0,y0);
+ Draw(currp,x1,y1); // NB: does not support width,dotted,dashed
+
+ return true;
}
bool ami_polygon(int *p, unsigned int n, colour fill)
{
+ printf("poly\n");
+ return true;
}
bool ami_fill(int x0, int y0, int x1, int y1, colour c)
{
+ printf("fill\n");
+ p96RectFill(currp,x0,y0,x1,y1,
+ p96EncodeColor(RGBFB_A8B8G8R8,c));
+ return true;
}
bool ami_clip(int x0, int y0, int x1, int y1)
{
+ clipx=x1;
+ clipy=y1;
+
+ return true;
}
bool ami_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- printf("%s\n",text);
+/* copied from css/css.h - need to open the correct font here
+ * font properties *
+ css_font_family font_family;
+ struct {
+ css_font_size_type size;
+ union {
+ struct css_length length;
+ float absolute;
+ float percent;
+ } value;
+ } font_size;
+ css_font_style font_style;
+ css_font_variant font_variant;
+ css_font_weight font_weight;
+
+ struct {
+ enum { CSS_HEIGHT_INHERIT,
+ CSS_HEIGHT_AUTO,
+ CSS_HEIGHT_LENGTH,
+ CSS_HEIGHT_NOT_SET } height;
+ struct css_length length;
+ } height;
+
+ struct {
+ enum { CSS_LETTER_SPACING_INHERIT,
+ CSS_LETTER_SPACING_NORMAL,
+ CSS_LETTER_SPACING_LENGTH,
+ CSS_LETTER_SPACING_NOT_SET } letter_spacing;
+ struct css_length length;
+ } letter_spacing;
+
+ struct {
+ enum { CSS_LINE_HEIGHT_INHERIT,
+ CSS_LINE_HEIGHT_ABSOLUTE,
+ CSS_LINE_HEIGHT_LENGTH,
+ CSS_LINE_HEIGHT_PERCENT,
+ CSS_LINE_HEIGHT_NOT_SET } size;
+ union {
+ float absolute;
+ struct css_length length;
+ float percent;
+ } value;
+ } line_height;
+*/
+
+ SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
+ TAG_DONE);
+ Move(currp,x,y);
+ Text(currp,text,length);
+ return true;
}
bool ami_disc(int x, int y, int radius, colour c, bool filled)
{
+ printf("disc\n");
+ SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ TAG_DONE);
+ DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
+ return true;
}
bool ami_arc(int x, int y, int radius, int angle1, int angle2,
colour c)
{
+ printf("arc\n");
+ return true;
}
bool ami_bitmap(int x, int y, int width, int height,
@@ -91,11 +174,16 @@ bool ami_bitmap(int x, int y, int width, int height,
struct RenderInfo ri;
printf("bitmap plotter\n");
+
+// ami_fill(x,y,x+width,y+height,bg);
+
ri.Memory = bitmap->pixdata;
- ri.BytesPerRow = bitmap->width * 3;
- ri.RGBFormat = RGBFB_B8G8R8;
+ ri.BytesPerRow = bitmap->width * 4;
+ ri.RGBFormat = RGBFB_A8R8G8B8;
+
+ p96WritePixelArray((struct RenderInfo *)&ri,0,0,currp,x,y,width,height);
- p96WritePixelArray((struct RenderInfo *)&ri,0,0,curwin->win->RPort,x,y,width,height);
+ return true;
}
bool ami_bitmap_tile(int x, int y, int width, int height,
@@ -103,23 +191,30 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
bool repeat_x, bool repeat_y)
{
printf("bitmap tile plotter\n");
+ return true;
}
bool ami_group_start(const char *name)
{
/** optional */
+ return false;
}
bool ami_group_end(void)
{
/** optional */
+ return false;
}
bool ami_flush(void)
{
+ printf("flush\n");
+ return true;
}
bool ami_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
{
+ printf("path\n");
+ return true;
}