Forum > General

form canvas array?

(1/1)

jw:
Is there a way to create an array of the forms canvas?

like so
form1.canvas[1].draw(etc......
form1.canvas[2].draw(etc...
form1.canvas[x]draw.........

this way each canvas could be updated independently of each other?

eny:

--- Code: ---  TForm1 = class(TForm)
  private
    CanvasArray: array[0..<choose size>] of TCanvas; // ?
  end;

--- End code ---

Marc:
A from has only one canvas. if you want multiple canvases, use a paintbox and several TBitmaps, paint on the bitmap.canvas whenever you want, draw the bitmaps in the paintbox.onpait event.

jw:
marc

I think the problem ends up being what you said in one of my other posts.

The LCL doesn't draw an alpha image on an exiting background, so the image replaces.


so is this how it works?

If I have 3 paintboxes I update paintbox 3 by animating the sprite.
this clears the form.canvas and redraws all paintbox canvases to the form.canvas in the zorder.


the reason I ask is because I've been trying to cordinate all sprites by drawing them to the form.canvas directly to make more effecient code.  I've found that no matter what any change to a paintbox leads to  canvas form redraw which is why I asked the dc windowless question in the graphics forum. 

I thought I could make an array of canvases for the form that could be altered independently then do an alpha blend by useing my post how do I make a transparent background.  I've already done something similar useing multiple form as I said in the dc windowless post but it has it's drawbacks.

Navigation

[0] Message Index

Go to full version