Added support for scaling bitmaps, filled polygons, filled circles and clipping.
Fixes major display issues with eg. www.bbc.co.uk amongst others. svn path=/trunk/netsurf/; revision=5221
This commit is contained in:
parent
35befab994
commit
277262bf46
109
amiga/gui.c
109
amiga/gui.c
|
@ -472,23 +472,55 @@ void ami_get_msg(void)
|
||||||
switch(subnum)
|
switch(subnum)
|
||||||
{
|
{
|
||||||
BPTR fh=0;
|
BPTR fh=0;
|
||||||
|
char fname[1024];
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
save_as_text(gwin->bw->current_content,"ram:ns_text");
|
if(AslRequestTags(filereq,
|
||||||
|
ASLFR_TitleText,messages_get("NetSurf"),
|
||||||
|
ASLFR_Screen,scrn,
|
||||||
|
ASLFR_DoSaveMode,TRUE,
|
||||||
|
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
|
||||||
|
TAG_DONE))
|
||||||
|
{
|
||||||
|
strlcpy(&fname,filereq->fr_Drawer,1024);
|
||||||
|
AddPart(&fname,filereq->fr_File,1024);
|
||||||
|
save_as_text(gwin->bw->current_content,&fname);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if(fh = FOpen("ram:ns_source",MODE_NEWFILE,0))
|
if(AslRequestTags(filereq,
|
||||||
|
ASLFR_TitleText,messages_get("NetSurf"),
|
||||||
|
ASLFR_Screen,scrn,
|
||||||
|
ASLFR_DoSaveMode,TRUE,
|
||||||
|
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
|
||||||
|
TAG_DONE))
|
||||||
|
{
|
||||||
|
strlcpy(&fname,filereq->fr_Drawer,1024);
|
||||||
|
AddPart(&fname,filereq->fr_File,1024);
|
||||||
|
if(fh = FOpen(&fname,MODE_NEWFILE,0))
|
||||||
{
|
{
|
||||||
FWrite(fh,gwin->bw->current_content->source_data,1,gwin->bw->current_content->source_size);
|
FWrite(fh,gwin->bw->current_content->source_data,1,gwin->bw->current_content->source_size);
|
||||||
FClose(fh);
|
FClose(fh);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
#ifdef WITH_PDF_EXPORT
|
#ifdef WITH_PDF_EXPORT
|
||||||
|
if(AslRequestTags(filereq,
|
||||||
|
ASLFR_TitleText,messages_get("NetSurf"),
|
||||||
|
ASLFR_Screen,scrn,
|
||||||
|
ASLFR_DoSaveMode,TRUE,
|
||||||
|
ASLFR_InitialFile,FilePart(gwin->bw->current_content->url),
|
||||||
|
TAG_DONE))
|
||||||
|
{
|
||||||
|
strlcpy(&fname,filereq->fr_Drawer,1024);
|
||||||
|
AddPart(&fname,filereq->fr_File,1024);
|
||||||
|
save_as_text(gwin->bw->current_content,&fname);
|
||||||
pdf_set_scale(DEFAULT_EXPORT_SCALE);
|
pdf_set_scale(DEFAULT_EXPORT_SCALE);
|
||||||
save_as_pdf(gwin->bw->current_content,"ram:ns_pdf");
|
save_as_pdf(gwin->bw->current_content,&fname);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -927,6 +959,16 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||||
gwin->rp.BitMap = gwin->bm;
|
gwin->rp.BitMap = gwin->bm;
|
||||||
SetDrMd(currp,BGBACKFILL);
|
SetDrMd(currp,BGBACKFILL);
|
||||||
|
|
||||||
|
gwin->layerinfo = NewLayerInfo();
|
||||||
|
gwin->rp.Layer = CreateUpfrontLayer(gwin->layerinfo,gwin->bm,0,0,scrn->Width-1,scrn->Height-1,0,NULL);
|
||||||
|
|
||||||
|
gwin->areabuf = AllocVec(100,MEMF_CLEAR);
|
||||||
|
gwin->rp.AreaInfo = AllocVec(sizeof(struct AreaInfo),MEMF_CLEAR);
|
||||||
|
InitArea(gwin->rp.AreaInfo,gwin->areabuf,100/5);
|
||||||
|
gwin->rp.TmpRas = AllocVec(sizeof(struct TmpRas),MEMF_CLEAR);
|
||||||
|
gwin->tmprasbuf = AllocVec(scrn->Width*scrn->Height,MEMF_CLEAR);
|
||||||
|
InitTmpRas(gwin->rp.TmpRas,gwin->tmprasbuf,scrn->Width*scrn->Height);
|
||||||
|
|
||||||
GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE);
|
GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE);
|
||||||
|
|
||||||
GetAttr(WINDOW_HorizObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_HSCROLL]);
|
GetAttr(WINDOW_HorizObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_HSCROLL]);
|
||||||
|
@ -960,7 +1002,13 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||||
void gui_window_destroy(struct gui_window *g)
|
void gui_window_destroy(struct gui_window *g)
|
||||||
{
|
{
|
||||||
DisposeObject(g->objects[OID_MAIN]);
|
DisposeObject(g->objects[OID_MAIN]);
|
||||||
|
DeleteLayer(0,g->rp.Layer);
|
||||||
|
DisposeLayerInfo(g->layerinfo);
|
||||||
p96FreeBitMap(g->bm);
|
p96FreeBitMap(g->bm);
|
||||||
|
FreeVec(g->rp.TmpRas);
|
||||||
|
FreeVec(g->rp.AreaInfo);
|
||||||
|
FreeVec(g->tmprasbuf);
|
||||||
|
FreeVec(g->areabuf);
|
||||||
DelObject(g->node);
|
DelObject(g->node);
|
||||||
// FreeVec(g); should be freed by DelObject()
|
// FreeVec(g); should be freed by DelObject()
|
||||||
|
|
||||||
|
@ -981,7 +1029,7 @@ void gui_window_set_title(struct gui_window *g, const char *title)
|
||||||
|
|
||||||
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
|
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
DebugPrintF("REDRAW\n");
|
// DebugPrintF("REDRAW\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_window_redraw_window(struct gui_window *g)
|
void gui_window_redraw_window(struct gui_window *g)
|
||||||
|
@ -1001,7 +1049,7 @@ void gui_window_update_box(struct gui_window *g,
|
||||||
GetAttr(SCROLLER_Top,g->objects[OID_HSCROLL],&hcurrent);
|
GetAttr(SCROLLER_Top,g->objects[OID_HSCROLL],&hcurrent);
|
||||||
GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],&vcurrent);
|
GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],&vcurrent);
|
||||||
|
|
||||||
DebugPrintF("DOING REDRAW\n");
|
// DebugPrintF("DOING REDRAW\n");
|
||||||
|
|
||||||
c = g->bw->current_content;
|
c = g->bw->current_content;
|
||||||
|
|
||||||
|
@ -1049,16 +1097,17 @@ void gui_window_update_box(struct gui_window *g,
|
||||||
|
|
||||||
void ami_do_redraw(struct gui_window *g)
|
void ami_do_redraw(struct gui_window *g)
|
||||||
{
|
{
|
||||||
|
struct Region *reg = NULL;
|
||||||
|
struct Rectangle rect;
|
||||||
struct content *c;
|
struct content *c;
|
||||||
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
|
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
|
||||||
struct IBox *bbox;
|
struct IBox *bbox;
|
||||||
struct Region *region;
|
|
||||||
|
|
||||||
GetAttr(SPACE_AreaBox,g->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
GetAttr(SPACE_AreaBox,g->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
||||||
GetAttr(SCROLLER_Top,g->objects[OID_HSCROLL],&hcurrent);
|
GetAttr(SCROLLER_Top,g->objects[OID_HSCROLL],&hcurrent);
|
||||||
GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],&vcurrent);
|
GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],&vcurrent);
|
||||||
|
|
||||||
DebugPrintF("DOING REDRAW\n");
|
// DebugPrintF("DOING REDRAW\n");
|
||||||
|
|
||||||
c = g->bw->current_content;
|
c = g->bw->current_content;
|
||||||
|
|
||||||
|
@ -1068,14 +1117,22 @@ void ami_do_redraw(struct gui_window *g)
|
||||||
current_redraw_browser = g->bw;
|
current_redraw_browser = g->bw;
|
||||||
|
|
||||||
currp = &g->rp;
|
currp = &g->rp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
layerinfo = NewLayerInfo();
|
reg = NewRegion();
|
||||||
layer = CreateLayer(layerinfo,LAYA_BitMap,g->bm,LAYA_StayTop,TRUE,
|
|
||||||
LAYA_MinX,0,LAYA_MinY,0,LAYA_MaxX,1024,LAYA_MaxY,768,TAG_DONE);
|
rect.MinX = 0;
|
||||||
currp = layer->rp;
|
rect.MinY = 0;
|
||||||
// region = NewRegion();
|
rect.MaxX = 1023;
|
||||||
// InstallClipRegion(layer,region);
|
rect.MaxY = 767;
|
||||||
|
|
||||||
|
OrRectRegion(reg,&rect);
|
||||||
|
|
||||||
|
InstallClipRegion(g->rp.Layer,reg);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// currp = g->rp.Layer->rp;
|
||||||
|
|
||||||
width=bbox->Width;
|
width=bbox->Width;
|
||||||
height=bbox->Height;
|
height=bbox->Height;
|
||||||
xoffset=bbox->Left;
|
xoffset=bbox->Left;
|
||||||
|
@ -1110,16 +1167,18 @@ LAYA_MinX,0,LAYA_MinY,0,LAYA_MaxX,1024,LAYA_MaxY,768,TAG_DONE);
|
||||||
|
|
||||||
current_redraw_browser = NULL;
|
current_redraw_browser = NULL;
|
||||||
currp = &dummyrp;
|
currp = &dummyrp;
|
||||||
/*
|
|
||||||
// InstallClipRegion(layer,NULL);
|
|
||||||
// DisposeRegion(region);
|
|
||||||
DeleteLayer(0,layer);
|
|
||||||
DisposeLayerInfo(layerinfo);
|
|
||||||
*/
|
|
||||||
ami_update_buttons(g);
|
ami_update_buttons(g);
|
||||||
|
|
||||||
BltBitMapRastPort(g->bm,0,0,g->win->RPort,xoffset,yoffset,width,height,0x0C0);
|
BltBitMapRastPort(g->bm,0,0,g->win->RPort,xoffset,yoffset,width,height,0x0C0);
|
||||||
|
|
||||||
|
reg = InstallClipRegion(g->rp.Layer,NULL);
|
||||||
|
if(reg) DisposeRegion(reg);
|
||||||
|
|
||||||
|
// DeleteLayer(0,g->rp.Layer);
|
||||||
|
/**/
|
||||||
|
|
||||||
g->redraw_required = false;
|
g->redraw_required = false;
|
||||||
g->redraw_data = NULL;
|
g->redraw_data = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1263,16 +1322,18 @@ void gui_window_remove_caret(struct gui_window *g)
|
||||||
|
|
||||||
void gui_window_new_content(struct gui_window *g)
|
void gui_window_new_content(struct gui_window *g)
|
||||||
{
|
{
|
||||||
DebugPrintF("new content\n");
|
// DebugPrintF("new content\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gui_window_scroll_start(struct gui_window *g)
|
bool gui_window_scroll_start(struct gui_window *g)
|
||||||
{
|
{
|
||||||
|
DebugPrintF("scroll start\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gui_window_box_scroll_start(struct gui_window *g,
|
bool gui_window_box_scroll_start(struct gui_window *g,
|
||||||
int x0, int y0, int x1, int y1)
|
int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
|
DebugPrintF("box scroll start\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gui_window_frame_resize_start(struct gui_window *g)
|
bool gui_window_frame_resize_start(struct gui_window *g)
|
||||||
|
@ -1293,7 +1354,7 @@ struct gui_download_window *gui_download_window_create(const char *url,
|
||||||
const char *mime_type, struct fetch *fetch,
|
const char *mime_type, struct fetch *fetch,
|
||||||
unsigned int total_size, struct gui_window *gui)
|
unsigned int total_size, struct gui_window *gui)
|
||||||
{
|
{
|
||||||
char *fname = AllocVec(1024,MEMF_CLEAR);
|
char fname[1024];
|
||||||
struct gui_download_window *dw;
|
struct gui_download_window *dw;
|
||||||
APTR va[3];
|
APTR va[3];
|
||||||
|
|
||||||
|
@ -1304,8 +1365,8 @@ struct gui_download_window *gui_download_window_create(const char *url,
|
||||||
ASLFR_InitialFile,FilePart(url),
|
ASLFR_InitialFile,FilePart(url),
|
||||||
TAG_DONE))
|
TAG_DONE))
|
||||||
{
|
{
|
||||||
strlcpy(fname,filereq->fr_Drawer,1024);
|
strlcpy(&fname,filereq->fr_Drawer,1024);
|
||||||
AddPart(fname,filereq->fr_File,1024);
|
AddPart(&fname,filereq->fr_File,1024);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
|
|
||||||
|
@ -1318,7 +1379,7 @@ struct gui_download_window *gui_download_window_create(const char *url,
|
||||||
va[1] = dw->size;
|
va[1] = dw->size;
|
||||||
va[2] = 0;
|
va[2] = 0;
|
||||||
|
|
||||||
if(!(dw->fh = FOpen(fname,MODE_NEWFILE,0)))
|
if(!(dw->fh = FOpen(&fname,MODE_NEWFILE,0)))
|
||||||
{
|
{
|
||||||
FreeVec(dw);
|
FreeVec(dw);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct gui_download_window {
|
||||||
Object *objects[OID_LAST];
|
Object *objects[OID_LAST];
|
||||||
struct Gadget *gadgets[GID_LAST];
|
struct Gadget *gadgets[GID_LAST];
|
||||||
struct nsObject *node;
|
struct nsObject *node;
|
||||||
bool pad;
|
ULONG pad[2];
|
||||||
BPTR fh;
|
BPTR fh;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
uint32 downloaded;
|
uint32 downloaded;
|
||||||
|
@ -67,9 +67,13 @@ struct gui_window {
|
||||||
struct Gadget *gadgets[GID_LAST];
|
struct Gadget *gadgets[GID_LAST];
|
||||||
struct nsObject *node;
|
struct nsObject *node;
|
||||||
bool redraw_required;
|
bool redraw_required;
|
||||||
|
struct List *tab_bw_list;
|
||||||
struct browser_window *bw;
|
struct browser_window *bw;
|
||||||
struct BitMap *bm;
|
struct BitMap *bm;
|
||||||
struct RastPort rp;
|
struct RastPort rp;
|
||||||
|
struct Layer_Info *layerinfo;
|
||||||
|
APTR areabuf;
|
||||||
|
APTR tmprasbuf;
|
||||||
struct Hook scrollerhook;
|
struct Hook scrollerhook;
|
||||||
struct Hook popuphook;
|
struct Hook popuphook;
|
||||||
struct form_control *control;
|
struct form_control *control;
|
||||||
|
@ -80,9 +84,6 @@ struct gui_window {
|
||||||
int c_h;
|
int c_h;
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct gui_window *curwin;
|
|
||||||
struct RastPort *currp;
|
struct RastPort *currp;
|
||||||
struct TextFont *origrpfont;
|
struct TextFont *origrpfont;
|
||||||
struct Layer *layer;
|
|
||||||
struct Layer_Info *layerinfo;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
127
amiga/plotters.c
127
amiga/plotters.c
|
@ -26,10 +26,7 @@
|
||||||
#include <graphics/rpattr.h>
|
#include <graphics/rpattr.h>
|
||||||
#include <graphics/gfxmacros.h>
|
#include <graphics/gfxmacros.h>
|
||||||
#include "amiga/utf8.h"
|
#include "amiga/utf8.h"
|
||||||
|
#include <proto/layers.h>
|
||||||
#include <proto/exec.h> // for debugprintf only
|
|
||||||
|
|
||||||
static clipx0=0,clipx1=0,clipy0=0,clipy1=0;
|
|
||||||
|
|
||||||
#define PATT_DOT 0xAAAA
|
#define PATT_DOT 0xAAAA
|
||||||
#define PATT_DASH 0xCCCC
|
#define PATT_DASH 0xCCCC
|
||||||
|
@ -50,33 +47,24 @@ const struct plotter_table amiplot = {
|
||||||
ami_bitmap_tile,
|
ami_bitmap_tile,
|
||||||
NULL, //ami_group_start,
|
NULL, //ami_group_start,
|
||||||
NULL, //ami_group_end,
|
NULL, //ami_group_end,
|
||||||
ami_flush, // optional
|
NULL, //ami_flush, // optional
|
||||||
ami_path,
|
ami_path,
|
||||||
true // option_knockout
|
true // option_knockout
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ami_clg(colour c)
|
bool ami_clg(colour c)
|
||||||
{
|
{
|
||||||
DebugPrintF("clg %lx\n",c);
|
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
ClearScreen(currp);
|
ClearScreen(currp);
|
||||||
|
|
||||||
/*
|
|
||||||
p96RectFill(currp,clipx0,clipy0,clipx1,clipy1,
|
|
||||||
p96EncodeColor(RGBFB_A8B8G8R8,c));
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ami_rectangle(int x0, int y0, int width, int height,
|
bool ami_rectangle(int x0, int y0, int width, int height,
|
||||||
int line_width, colour c, bool dotted, bool dashed)
|
int line_width, colour c, bool dotted, bool dashed)
|
||||||
{
|
{
|
||||||
DebugPrintF("rect\n");
|
|
||||||
|
|
||||||
currp->PenWidth = line_width;
|
currp->PenWidth = line_width;
|
||||||
currp->PenHeight = line_width;
|
currp->PenHeight = line_width;
|
||||||
|
|
||||||
|
@ -102,8 +90,6 @@ bool ami_rectangle(int x0, int y0, int width, int height,
|
||||||
bool ami_line(int x0, int y0, int x1, int y1, int width,
|
bool ami_line(int x0, int y0, int x1, int y1, int width,
|
||||||
colour c, bool dotted, bool dashed)
|
colour c, bool dotted, bool dashed)
|
||||||
{
|
{
|
||||||
DebugPrintF("line\n");
|
|
||||||
|
|
||||||
currp->PenWidth = width;
|
currp->PenWidth = width;
|
||||||
currp->PenHeight = width;
|
currp->PenHeight = width;
|
||||||
|
|
||||||
|
@ -128,24 +114,28 @@ bool ami_polygon(int *p, unsigned int n, colour fill)
|
||||||
int k;
|
int k;
|
||||||
ULONG cx,cy;
|
ULONG cx,cy;
|
||||||
|
|
||||||
DebugPrintF("poly\n");
|
//DebugPrintF("poly\n");
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
|
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
|
||||||
|
RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
Move(currp,p[0],p[1]);
|
AreaMove(currp,p[0],p[1]);
|
||||||
|
|
||||||
for(k=1;k<n;k++)
|
for(k=1;k<n;k++)
|
||||||
{
|
{
|
||||||
Draw(currp,p[k*2],p[(k*2)+1]);
|
AreaDraw(currp,p[k*2],p[(k*2)+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AreaEnd(currp);
|
||||||
|
BNDRYOFF(currp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ami_fill(int x0, int y0, int x1, int y1, colour c)
|
bool ami_fill(int x0, int y0, int x1, int y1, colour c)
|
||||||
{
|
{
|
||||||
DebugPrintF("fill %ld,%ld,%ld,%ld\n",x0,y0,x1,y1);
|
//DebugPrintF("fill %ld,%ld,%ld,%ld\n",x0,y0,x1,y1);
|
||||||
|
|
||||||
p96RectFill(currp,x0,y0,x1,y1,
|
p96RectFill(currp,x0,y0,x1,y1,
|
||||||
p96EncodeColor(RGBFB_A8B8G8R8,c));
|
p96EncodeColor(RGBFB_A8B8G8R8,c));
|
||||||
|
@ -155,13 +145,24 @@ bool ami_fill(int x0, int y0, int x1, int y1, colour c)
|
||||||
|
|
||||||
bool ami_clip(int x0, int y0, int x1, int y1)
|
bool ami_clip(int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
/* to do - need to actually clip to this region using layers.library */
|
struct Region *reg = NULL;
|
||||||
|
struct Rectangle rect;
|
||||||
|
|
||||||
DebugPrintF("clip\n");
|
if(currp->Layer)
|
||||||
clipx0=x0;
|
{
|
||||||
clipy0=y0;
|
reg = NewRegion();
|
||||||
clipx1=x1;
|
|
||||||
clipy1=y1;
|
rect.MinX = x0;
|
||||||
|
rect.MinY = y0;
|
||||||
|
rect.MaxX = x1-1;
|
||||||
|
rect.MaxY = y1-1;
|
||||||
|
|
||||||
|
OrRectRegion(reg,&rect);
|
||||||
|
|
||||||
|
reg = InstallClipRegion(currp->Layer,reg);
|
||||||
|
|
||||||
|
if(reg) DisposeRegion(reg);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -174,18 +175,22 @@ bool ami_text(int x, int y, const struct css_style *style,
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
||||||
RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
||||||
// RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
|
||||||
// RPTAG_Font,tfont,
|
// RPTAG_Font,tfont,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
utf8_to_local_encoding(text,length,&buffer);
|
utf8_to_local_encoding(text,length,&buffer);
|
||||||
// ami_utf8_to_any(text,length,&buffer);
|
|
||||||
|
|
||||||
if(!buffer) return true;
|
if(!buffer) return true;
|
||||||
|
|
||||||
|
/* Below function prints Unicode text direct to the RastPort.
|
||||||
|
* This is commented out due to lack of SDK which allows me to perform blits
|
||||||
|
* that respect the Alpha channel. The code below that (and above) convert to
|
||||||
|
* system default charset and write the text using graphics.library functions.
|
||||||
|
*
|
||||||
|
* ami_unicode_text(currp,text,length,style,x,y,c);
|
||||||
|
*/
|
||||||
Move(currp,x,y);
|
Move(currp,x,y);
|
||||||
Text(currp,buffer,strlen(buffer));
|
Text(currp,buffer,strlen(buffer));
|
||||||
// Text(currp,text,length);
|
|
||||||
|
|
||||||
ami_close_font(tfont);
|
ami_close_font(tfont);
|
||||||
ami_utf8_free(buffer);
|
ami_utf8_free(buffer);
|
||||||
|
@ -195,24 +200,18 @@ bool ami_text(int x, int y, const struct css_style *style,
|
||||||
|
|
||||||
bool ami_disc(int x, int y, int radius, colour c, bool filled)
|
bool ami_disc(int x, int y, int radius, colour c, bool filled)
|
||||||
{
|
{
|
||||||
struct AreaInfo ai;
|
|
||||||
APTR buf[10];
|
|
||||||
|
|
||||||
DebugPrintF("disc\n");
|
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
/* see rkrm
|
|
||||||
if(filled)
|
if(filled)
|
||||||
{
|
{
|
||||||
// InitArea(&ai,&buf,2);
|
|
||||||
AreaCircle(currp,x,y,radius);
|
AreaCircle(currp,x,y,radius);
|
||||||
// AreaEnd(currp);
|
AreaEnd(currp);
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
{
|
||||||
DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
|
DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +221,12 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2,
|
||||||
{
|
{
|
||||||
/* http://www.crbond.com/primitives.htm
|
/* http://www.crbond.com/primitives.htm
|
||||||
CommonFuncsPPC.lha */
|
CommonFuncsPPC.lha */
|
||||||
DebugPrintF("arc\n");
|
//DebugPrintF("arc\n");
|
||||||
|
|
||||||
|
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
|
||||||
|
TAG_DONE);
|
||||||
|
|
||||||
|
// DrawArc(currp,x,y,(float)angle1,(float)angle2,radius);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -232,10 +236,6 @@ bool ami_bitmap(int x, int y, int width, int height,
|
||||||
{
|
{
|
||||||
struct RenderInfo ri;
|
struct RenderInfo ri;
|
||||||
|
|
||||||
DebugPrintF("bitmap plotter %ld %ld %ld %ld (%ld %ld)\n",x,y,width,height,bitmap->width,bitmap->height);
|
|
||||||
|
|
||||||
/* needs to also scale */
|
|
||||||
|
|
||||||
// ami_fill(x,y,x+width,y+height,bg);
|
// ami_fill(x,y,x+width,y+height,bg);
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
||||||
|
@ -245,7 +245,39 @@ DebugPrintF("bitmap plotter %ld %ld %ld %ld (%ld %ld)\n",x,y,width,height,bitmap
|
||||||
ri.BytesPerRow = bitmap->width * 4;
|
ri.BytesPerRow = bitmap->width * 4;
|
||||||
ri.RGBFormat = RGBFB_R8G8B8A8;
|
ri.RGBFormat = RGBFB_R8G8B8A8;
|
||||||
|
|
||||||
|
if((bitmap->width != width) || (bitmap->height != height))
|
||||||
|
{
|
||||||
|
struct BitMap *tbm;
|
||||||
|
struct RastPort trp;
|
||||||
|
struct BitScaleArgs bsa;
|
||||||
|
|
||||||
|
tbm = p96AllocBitMap(bitmap->width,bitmap->height,32,0,currp->BitMap,RGBFB_R8G8B8A8);
|
||||||
|
InitRastPort(&trp);
|
||||||
|
trp.BitMap = tbm;
|
||||||
|
p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
|
||||||
|
bsa.bsa_SrcX = 0;
|
||||||
|
bsa.bsa_SrcY = 0;
|
||||||
|
bsa.bsa_SrcWidth = bitmap->width;
|
||||||
|
bsa.bsa_SrcHeight = bitmap->height;
|
||||||
|
bsa.bsa_DestX = x;
|
||||||
|
bsa.bsa_DestY = y;
|
||||||
|
bsa.bsa_DestWidth = width;
|
||||||
|
bsa.bsa_DestHeight = height;
|
||||||
|
bsa.bsa_XSrcFactor = bitmap->width;
|
||||||
|
bsa.bsa_XDestFactor = width;
|
||||||
|
bsa.bsa_YSrcFactor = bitmap->height;
|
||||||
|
bsa.bsa_YDestFactor = height;
|
||||||
|
bsa.bsa_SrcBitMap = tbm;
|
||||||
|
bsa.bsa_DestBitMap = currp->BitMap;
|
||||||
|
bsa.bsa_Flags = 0;
|
||||||
|
|
||||||
|
BitMapScale(&bsa);
|
||||||
|
p96FreeBitMap(tbm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
p96WritePixelArray((struct RenderInfo *)&ri,0,0,currp,x,y,width,height);
|
p96WritePixelArray((struct RenderInfo *)&ri,0,0,currp,x,y,width,height);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +289,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
|
||||||
struct RenderInfo ri;
|
struct RenderInfo ri;
|
||||||
ULONG xf,yf,wf,hf;
|
ULONG xf,yf,wf,hf;
|
||||||
|
|
||||||
DebugPrintF("bitmap tile plotter\n");
|
//DebugPrintF("bitmap tile plotter\n");
|
||||||
|
|
||||||
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
@ -292,7 +324,6 @@ if(repeat_y) printf("repeaty\n");
|
||||||
hf=bitmap->height;
|
hf=bitmap->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("%ld %ld %ld\n",xf,width,bitmap->width);
|
|
||||||
p96WritePixelArray((struct RenderInfo *)&ri,0,0,currp,x+xf,y+yf,wf,hf);
|
p96WritePixelArray((struct RenderInfo *)&ri,0,0,currp,x+xf,y+yf,wf,hf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,13 +345,13 @@ bool ami_group_end(void)
|
||||||
|
|
||||||
bool ami_flush(void)
|
bool ami_flush(void)
|
||||||
{
|
{
|
||||||
DebugPrintF("flush\n");
|
//DebugPrintF("flush\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ami_path(float *p, unsigned int n, colour fill, float width,
|
bool ami_path(float *p, unsigned int n, colour fill, float width,
|
||||||
colour c, float *transform)
|
colour c, float *transform)
|
||||||
{
|
{
|
||||||
DebugPrintF("path\n");
|
/* Not implemented yet - unable to locate website which requires this plotter! */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue