has noone an idea, how to get this faster done? i also tried without close_path, but nothing changes.
my current try is to draw as tiled pixmap:
old code:
Code:
for (int i=1;i<fWidth;i++)
{
for (int j=1;j<fHeight;j++)
{
p=Point(i,j);
p=CalcAbsolute(p);
//Canvas_Circle(pm,x-fHoleRadius,y-fHoleRadius,2*fHoleRadius,2*fHoleRadius,clr);
canvas_grid.DrawEllipse(p.x-fHoleRadius,p.y-fHoleRadius,2*fHoleRadius,2*fHoleRadius);
//DrawPoint(pixmap_grid,i,j,clSilver);
}
}
new code:
Code:
GdkPixmap *pm_tmp = gdk_pixmap_new(DrawingArea->window,
fHoleSpacing,
fHoleSpacing,
24);
TCanvas cv_tmp;
cv_tmp.Init(pm_tmp);
cv_tmp.SetFGColor(clSilver);
//draw a single circle as pattern
cv_tmp.DrawEllipse(0,0,2*fHoleRadius,2*fHoleRadius);
//draw this pattern starting at position fHoleRadius
canvas_grid.DrawTiledPixmap(pm_tmp,fHoleRadius,fHoleRadius,w-fHoleRadius,h-fHoleRadius);
gdk_pixmap_unref(pm_tmp);
where DrawTiledBitmap is defined like this:
Code:
void TCanvas::DrawTiledPixmap(GdkPixmap *pixmap,int x,int y,int w,int h)
{
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle (cr, x, y, w, h);
cairo_fill (cr);
}
this draws faster, but i cannot get my circles aligned the right way.
cairo starts not with a full pattern in the upper left corner...how to get this solved?
i've solved the incorrect alignment:
Code:
gdk_cairo_set_source_pixmap (cr, pixmap, 0-x, 0-y);
but maybe it exists a possibility to draw circles faster with cairo...pls post some suggestions