Support
SiteLinks |
FAQ /
Drawing<< General | Frequently asked questions | Layers >> 1. I'm trying to paint a red line, but it draws the green one, or nothing at all. What's wrong?Do not use standard TColor constants with Graphics32, like clBlack, clGreen etc. Use native Graphics32 color definitions: clBlack32, clGreen32, etc. This are predefined values of the TColor32 type. It is possible to transform the color from Graphics32 native format to/from Delphi's format. See function Color32 and "Color Construction" topic in documentation. 2. What about drawing thick antialiazed lines?The only way you can draw thick lines is by using polygons. Create a new TPolygon32 instance, add the necessary segments, then transform it to the outline, using TPolygon32.Grow. Now you can rasterize the new outline using standard polygon drawing methods. You will find the sample code in Polygons_Ex project. A very simple Thickline: (by Mike Johnson @ http://www.bigattichouse.com ) procedure ThickLine(bitmap:Tbitmap32;x,y,x2,y2:integer;color:TColor32); var polygon: TPolygon32; begin polygon:=TPolygon32.create; polygon.Add(fixedpoint(x-2,y)); polygon.Add(fixedpoint(x+2,y)); polygon.Add(fixedpoint(x2+2,y2)); polygon.Add(fixedpoint(x2-2,y2)); polygon.Drawfill(bitmap,color); polygon.Clear; polygon.Add(fixedpoint(x,y+2)); polygon.Add(fixedpoint(x,y-2)); polygon.Add(fixedpoint(x2,y2-2)); polygon.Add(fixedpoint(x2,y2+2)); polygon.Drawfill(bitmap,color); polygon.free; end; |