You are not logged in.
Pages: 1
I've been trying out the synpdf libray and I noticed that if I draw a shape and fill with either vertical or horizontal gradients the gradient bleeds out the shape. On screen it looks ok, but the pdf file is not right. Oddly enough a radial gradient works fine. See screens shots below. I'm using GDI+ top do my drawing. Are there any limitations to synpdf or is there something I should be doing to fix this?
To draw the shapes, eg ellipse, I create a path using GdipAddPathEllipse() then use FillPath with a linearGradientBursh to fill the shape.
Update 1: I should mention that for historical reasons I am using the GDI+ library from http://www.progdigy.com. Perhaps I should be using synGdiPlus?
Update 2: Must be something I'm doing because on a small test application I get:
Am investigating.
Update 3: The shape I am trying to draw is a round rectangle which requires me to describe it using a path. It seems that gradients, other than radial, do not confine themselves to the path in synPdf, the following code will create the image shown:
procedure TCircle.paint (canvas : TCanvas);
var path : TGPGraphicsPath;
Graphics: TGPGraphics;
linearBrush: TGPLinearGradientBrush;
pen : TGPPen;
r : TGPRectF;
begin
graphics := TGPGraphics.Create(canvas.Handle);
path := TGPGraphicsPath.Create;
pen := TGPPen.Create (MakeColor(160, 10, 100));
try
pen.setWidth(2);
r := makeRect(20., 20, 180, 180);
linearBrush := TGPLinearGradientBrush.Create(r, GPColor (clWebRed), GPColor (clWebYellow), LinearGradientModeVertical);
path.addEllipse(r);
graphics.fillPath(linearBrush, path);
graphics.drawPath (pen, path);
finally
graphics.Free;
pen.Free;
path.Free;
end;
end;
Works ok on screen but produces the following in the pdf output:
Any ideas?
Pages: 1