sp-canvas-util.cpp revision 6b15695578f07a3f72c4c9475c1a261a3021472a
#define __SP_CANVAS_UTILS_C__
/*
* Helper stuff for SPCanvas
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "libnr/nr-matrix-div.h"
#include "libnr/nr-pixops.h"
#include "sp-canvas-util.h"
#include <livarot/int-line.h>
#include <livarot/BitLigne.h>
void
{
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
}
void
{
}
void
{
}
}
void
{
unsigned char r, g, b;
if ((r != g) || (r != b)) {
int x, y;
unsigned char *p;
*p++ = r;
*p++ = g;
*p++ = b;
}
}
} else {
int y;
}
}
}
{
// plausible that this gets called
// with item == 0
}
{
}
{
}
{
return;
if (z == current_z)
return;
if (z > current_z)
}
{
return 0;
}
// These two functions are used by canvasitems that use livarot (currently ctrlline and ctrlquadr)
void
{
union {
} tempCol;
unsigned int r, g, b, a;
if (a == 0) return;
vst*=a;
ven*=a;
if ( sv > 249.999 ) {
/* Simple copy */
while (len > 0) {
d[0] = INK_COMPOSE (r, 255, d[0]);
d += 3;
len -= 1;
}
} else {
c0_24&=0xFF;
while (len > 0) {
d[0] = INK_COMPOSE (r, c0_24, d[0]);
d += 3;
len -= 1;
}
}
} else {
c0_24&=0xFF;
d[0] = INK_COMPOSE (r, c0_24, d[0]);
} else {
sv*=65536;
dv*=65536;
while (len > 0) {
unsigned int ca;
/* Draw */
d[0] = INK_COMPOSE (r, ca, d[0]);
d += 3;
len -= 1;
}
}
}
}
void nr_pixblock_render_ctrl_rgba (Shape* theS,uint32_t color,NRRectL &area,char* destBuf,int stride)
{
// printf("bbox %i %i %i %i render %i %i %i %i\n",il,it,ir,ib,area.x0,area.y0,area.x1,area.y1);
/* // version par FloatLigne
int curPt;
float curY;
theS->BeginRaster(curY,curPt,1.0);
FloatLigne* theI=new FloatLigne();
IntLigne* theIL=new IntLigne();
theS->Scan(curY,curPt,(float)(it),1.0);
char* mdata=(char*)destBuf;
uint32_t* ligStart=((uint32_t*)(mdata+(3*(il-area.x0)+stride*(it-area.y0))));
for (int y=it;y<ib;y++) {
theI->Reset();
if ( y&0x00000003 ) {
theS->Scan(curY,curPt,((float)(y+1)),theI,false,1.0);
} else {
theS->Scan(curY,curPt,((float)(y+1)),theI,true,1.0);
}
theI->Flatten();
theIL->Copy(theI);
raster_info dest;
dest.startPix=il;
dest.endPix=ir;
dest.sth=il;
dest.stv=y;
dest.buffer=ligStart;
theIL->Raster(dest,&color,bpath_run_A8_OR);
ligStart=((uint32_t*)(((char*)ligStart)+stride));
}
theS->EndRaster();
delete theI;
delete theIL; */
// version par BitLigne directe
int curPt;
float curY;
}
theS->EndQuickRaster();
for (int i=0;i<4;i++) delete theI[i];
delete theIL;
}