Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TPaint and TCanvas
Thu, Dec 19 2013 6:15 AMPermanent Link

Matthew Jones

Could someone explain how the TPaint and its TCanvas work please?
There is no "OnPaint" event, so that sort of assumes that I can create a TPaint,
set its size, draw a picture of a tree on it, and then it will show that forever
with no further interaction. Is this the case?

What if I move the TPaint object on the form?
What if I duplicate the TPaint Object - can I copy the canvas easily?
What if it is moved around, or has other objects over the top of it?

How do browsers manage this stuff that I should know about?

/Matthew Jones/
Thu, Dec 19 2013 2:49 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Could someone explain how the TPaint and its TCanvas work please?
There is no "OnPaint" event, so that sort of assumes that I can create a
TPaint, set its size, draw a picture of a tree on it, and then it will show
that forever with no further interaction. Is this the case? >>

Correct.  A canvas in the browser is a static element, like a real canvas,
and not like the old, cruddy Windows approach of "paint-on-demand".

<< What if I move the TPaint object on the form?  >>

No  problem.

<< What if I duplicate the TPaint Object - can I copy the canvas easily? >>

Yes, you can do so, but EWB doesn't currently surface the ability to do so.
I'll see about adding a method for this, but in 1.03 you can, at the very
least, use the new ConvertToDataURL to do the copy in a round-about way.

<< What if it is moved around, or has other objects over the top of it? >>

Again, no problem.

<< How do browsers manage this stuff that I should know about? >>

Internally, they're probably just allowing you to draw on a bitmap and doing
some high-performance layer/element management in terms of transparency,
etc.  I remember reading some articles on how browsers like Chrome handle
this stuff under Windows during the initial EWB development, but damn if I
can remember the URLs now.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Dec 20 2013 5:00 AMPermanent Link

Matthew Jones

Thanks - I will investigate further. I was going to ask what happens if I resize
the TPaint, does it clear the canvas or not, but since I'd want to redraw it anyway
it doesn't matter.

/Matthew Jones/
Fri, Dec 20 2013 5:52 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Thanks - I will investigate further. I was going to ask what happens if I
resize the TPaint, does it clear the canvas or not, but since I'd want to
redraw it anyway it doesn't matter.  >>

Resizing the TPaint, which subsequently resizes the TCanvas instance, *will*
clear the canvas.

The new slideshow component/example project in 1.03 will definitely give you
some good information on some of the cool things you can do with the canvas.
If I can just get over this web server switch hump in the next couple of
days, I'll be able to get 1.03 out by early next week.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Dec 20 2013 8:47 AMPermanent Link

Matthew Jones

> I'll be able to get 1.03 out by early next week.

Just in time for Christmas! I'll tell the kids it is cancelled...

/Matthew Jones/

8-)
Sun, Dec 22 2013 7:36 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Just in time for Christmas! I'll tell the kids it is cancelled... >>

I wish it were EWB 2.0. Frown But, the web server move was supposed to happen
in January, so now I'll have January clear to get it finished.

Tim Young
Elevate Software
www.elevatesoft.com
Image