Re: Newbie looking for info on basic graphics with Delphi.



Mike Barnard wrote:
Do I need to use a canvas to draw? If not, how?
Where can I find some basic algorithms for wireframe drawing?

Control Canvases tend to be re-painted when you resize or
move or hide the window; unless you want to paint a different
picture in that case, i'd suggest using a tpicture.

Drop a tpicture on a form. Code:

// init
picture1.bitmap.width:=picture1.width;
picture1.bitmap.height:=picture1.height;
picture1.bitmap.pixelformat:=pf24bit;
// clear
picture1.bitmap.canvas.brush.color:=clwhite;
picture1.bitmap.canvas.fillrect(rect(0,0,picture1.width,picture1.height));


Now you can draw on picture1.bitmap.canvas without anything
overriding your picture.

try

// draw a line
picture1.bitmap.canvas.pen.color:=clGreen;
picture1.bitmap.canvas.moveto(100,100);
picture1.bitmap.canvas.lineto(200,200);

That should draw a green line from 100/100 to 200/200.

As wireframes consist of lines, that should be all you need.
.