Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread CopyRect with TPaint?
Fri, Jan 16 2015 4:48 PMPermanent Link

Jim Gallagher

I was trying to expand the paint demo, and noticed that there is apparently no exposed CopyRect method for TPaint.  Is this because JavaScript and/or HTML5 don't support this, or is it possible it will  be implemented in a future release?

Thanks,

-Jim
Fri, Jan 16 2015 11:30 PMPermanent Link

Raul

Team Elevate Team Elevate

On 1/16/2015 4:48 PM, Jim Gallagher wrote:
> I was trying to expand the paint demo, and noticed that there is apparently no exposed CopyRect method for TPaint.  Is this because JavaScript and/or HTML5 don't support this, or is it possible it will  be implemented in a future release?

I think it's the latter - something that would be added in the future.

The canvas is an HTML5 canvas object underneath and looking at the draft
spec
(https://html.spec.whatwg.org/multipage/scripting.html#the-canvas-element)
the "getImageData" followed by "putImageData" would likely achieve what
you're looking for. So support is present underneath and simply not in
the EWB.

You could try to add it yourself to the framework as it looks
straightforward enough (getting the ImageData right would be the hardest
part) but otherwise webctrls.wbs units is hwere the TCanvas is.

Or see if if ewb v2 adds it for you - hopefully coming soon now.

Raul
Mon, Jan 19 2015 12:54 AMPermanent Link

Jim Gallagher

Raul wrote:

>You could try to add it yourself to the framework as it looks
>straightforward enough (getting the ImageData right would be the hardest
>part) but otherwise webctrls.wbs units is hwere the TCanvas is.

That sounds a little outside my comfort zone, but I might poke around and see if I can find a simple example of integrating external Javascript in that way.

>Or see if if ewb v2 adds it for you - hopefully coming soon now.

I am much better at waiting Smiley..

Thanks Raul,
Mon, Jan 19 2015 8:33 AMPermanent Link

Raul

Team Elevate Team Elevate

On 1/19/2015 12:54 AM, Jim Gallagher wrote:
> That sounds a little outside my comfort zone, but I might poke around and see if I can find a simple example of integrating external Javascript in that way.

I don't think you need to use external javascript - i would try to
modify the framework itself (it 's one of the nice benefits of EWB since
you have the source).

Check out the TCanvas implementation in webctrls.wbs - if for nothing
else then just for a peek underneath Smile

Raul



Mon, Jan 19 2015 3:17 PMPermanent Link

Jim Gallagher

Raul wrote:

>I don't think you need to use external javascript - i would try to
>modify the framework itself (it 's one of the nice benefits of EWB since
>you have the source).

>Check out the TCanvas implementation in webctrls.wbs - if for nothing
>else then just for a peek underneath Smile


I have the evaluation version of EWB (I'm waiting for 2.0 to commit), so I assumed I didn't have access to any source, but I see that Elevate does generously supply that too, with the evaluation version.  I will experiment a little with that - if the Internet goes down, it's probably my fault...

Thanks for the pointer - I should become more familiar with the internals.

-Jim
Tue, Jan 20 2015 4:16 AMPermanent Link

Matthew Jones

Jim Gallagher wrote:

> I have the evaluation version of EWB (I'm waiting for 2.0 to commit),
> so I assumed I didn't have access to any source, but I see that
> Elevate does generously supply that too, with the evaluation version.
> I will experiment a little with that - if the Internet goes down,
> it's probably my fault...

I'll tell my son it was you...

But the other thing you need to know is that if you change the
framework, you must close the IDE to get it to read the changes as it
is cached. Obviously keep a backup...

And if you come up with something great, refine it, and pass it on to
Tim as he will often incorporate useful additions.


--

Matthew Jones
Wed, Jan 21 2015 3:02 AMPermanent Link

Jim Gallagher

"Matthew Jones" wrote:

>But the other thing you need to know is that if you change the
>framework, you must close the IDE to get it to read the changes as it
>is cached.

Thanks for the heads up.  I did spend some time looking at how some other HTML5 routines are called, and made a feeble attempt with get- and putImageData.  I could get those to work with Javascript in a browser, but Raul called it right when he said that the imageData object would be the difficult part.  One of its properties is an array of:

"Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 (included)".

This sounds like an array of bytes in the Object Pascal world, but the closest I could find in EWB was "char". I threw in the towel, but I learned quite a lot until my head exploded.

This was just an experiment anyway - no urgent need for copyRect at present.

-Jim
Wed, Jan 21 2015 4:12 AMPermanent Link

Matthew Jones

Jim Gallagher wrote:

> "Uint8ClampedArray representing a one-dimensional array containing
> the data in the RGBA order, with integer values between 0 and 255
> (included)".
>
> This sounds like an array of bytes in the Object Pascal world, but
> the closest I could find in EWB was "char". I threw in the towel, but
> I learned quite a lot until my head exploded.

If you have an account, login at
http://www.elevatesoft.com/incident?category=ewb and create a
suggestion to have this added. It would be good to have it on the
thinking about list.

--

Matthew Jones
Image