Skewing Forms in Squeak V2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Skewing Forms in Squeak V2

Iulian Wande Radu
Hi, I'd like to skew the graphics of a Form, is there an easy way to do this in v2 ?

What I want is to take the rectangle from a normal form, transform it into an arbitrarily-defined quadrilateral, and then paint on the screen. I saw that WarpBlt does something like this.. but it maps a quadrilateral section of a form onto a rectangle.


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Matthias Berth-2
Hi,

is WarpBlt available in Squeak V2?

On Tue, Jul 22, 2008 at 7:53 PM, Iulian Wande Radu
<[hidden email]> wrote:

> Hi, I'd like to skew the graphics of a Form, is there an easy way to do this
> in v2 ?
>
> What I want is to take the rectangle from a normal form, transform it into
> an arbitrarily-defined quadrilateral, and then paint on the screen. I saw
> that WarpBlt does something like this.. but it maps a quadrilateral section
> of a form onto a rectangle.
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Brad Fuller-4
what is Squeak V2?

On Tue, Jul 22, 2008 at 12:02 PM, Matthias Berth
<[hidden email]> wrote:

> Hi,
>
> is WarpBlt available in Squeak V2?
>
> On Tue, Jul 22, 2008 at 7:53 PM, Iulian Wande Radu
> <[hidden email]> wrote:
>> Hi, I'd like to skew the graphics of a Form, is there an easy way to do this
>> in v2 ?
>>
>> What I want is to take the rectangle from a normal form, transform it into
>> an arbitrarily-defined quadrilateral, and then paint on the screen. I saw
>> that WarpBlt does something like this.. but it maps a quadrilateral section
>> of a form onto a rectangle.
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>



--
Brad Fuller
www.bradfuller.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Iulian Wande Radu
Squeak V2 is the Squeak running on Version 2 source (the current Squeak version is around 3.9).


Back to the question...
Yes WarpBlt is available in v2, but I can't seem to be able to use it for this purpose, because it maps a quad to a rectangle (not a rectangle to a quad).
There must be a way to do this...


On Tue, Jul 22, 2008 at 3:27 PM, Brad Fuller <[hidden email]> wrote:
what is Squeak V2?

On Tue, Jul 22, 2008 at 12:02 PM, Matthias Berth
<[hidden email]> wrote:
> Hi,
>
> is WarpBlt available in Squeak V2?
>
> On Tue, Jul 22, 2008 at 7:53 PM, Iulian Wande Radu
> <[hidden email]> wrote:
>> Hi, I'd like to skew the graphics of a Form, is there an easy way to do this
>> in v2 ?
>>
>> What I want is to take the rectangle from a normal form, transform it into
>> an arbitrarily-defined quadrilateral, and then paint on the screen. I saw
>> that WarpBlt does something like this.. but it maps a quadrilateral section
>> of a form onto a rectangle.
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>



--
Brad Fuller
www.bradfuller.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Matthias Berth-2
So it comes down to this:

given a projective transformation T from a rectangle (your form) to a
quad Q (what you want to draw on screen), how can you express the same
transformation in terms of mapping a quad to a rectangle (what WarpBlt
needs)?

One possible plan is:

1) determine the transformation's parameters

2) take the bounding box of Q (a rectangle R) and transform it by the
inverse of T, giving you a quad Q'

3) use WarpBlt to transform pixels in Q' (should be a superset of your
form) to R

4) mask the result with your original quad Q, using pixel-by-pixel
operations on Forms

I think all you need in terms of mathematics for this is in
http://www.cs.cmu.edu/~ph/869/www/notes/proj/proj.pdf

Hope this helps, feel free to ask about the details,

Matthias



On Tue, Jul 22, 2008 at 9:31 PM, Iulian Wande Radu
<[hidden email]> wrote:

> Back to the question...
> Yes WarpBlt is available in v2, but I can't seem to be able to use it for
> this purpose, because it maps a quad to a rectangle (not a rectangle to a
> quad).
> There must be a way to do this...
>
>
> On Tue, Jul 22, 2008 at 3:27 PM, Brad Fuller <[hidden email]>
> wrote:
>>
>> what is Squeak V2?
>>
>> On Tue, Jul 22, 2008 at 12:02 PM, Matthias Berth
>> <[hidden email]> wrote:
>> > Hi,
>> >
>> > is WarpBlt available in Squeak V2?
>> >
>> > On Tue, Jul 22, 2008 at 7:53 PM, Iulian Wande Radu
>> > <[hidden email]> wrote:
>> >> Hi, I'd like to skew the graphics of a Form, is there an easy way to do
>> >> this
>> >> in v2 ?
>> >>
>> >> What I want is to take the rectangle from a normal form, transform it
>> >> into
>> >> an arbitrarily-defined quadrilateral, and then paint on the screen. I
>> >> saw
>> >> that WarpBlt does something like this.. but it maps a quadrilateral
>> >> section
>> >> of a form onto a rectangle.
>> >>
>> >>
>> >> _______________________________________________
>> >> Beginners mailing list
>> >> [hidden email]
>> >> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>> >>
>> >>
>> > _______________________________________________
>> > Beginners mailing list
>> > [hidden email]
>> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>> >
>>
>>
>>
>> --
>> Brad Fuller
>> www.bradfuller.com
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Yoshiki Ohshima-2
In reply to this post by Iulian Wande Radu
At Tue, 22 Jul 2008 13:53:21 -0400,
Iulian Wande Radu wrote:
>
> Hi, I'd like to skew the graphics of a Form, is there an easy way to do this in v2 ?
>
> What I want is to take the rectangle from a normal form, transform it into an arbitrarily-defined quadrilateral, and
> then paint on the screen. I saw that WarpBlt does something like this.. but it maps a quadrilateral section of a form
> onto a rectangle.

  There was similar a discussion on this a while ago:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-February/013402.html

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Iulian Wande Radu
Thank you for the guidelines for skewing forms.

I've followed Matthias' instructions (and the associated math doc) and skewing works well this way through WarpBlt. (The code linked by Yoshiki was too slow and didn't work fully).

I wrote the math conversions in a C DLL, and it would probably be useful for people. Is there any place where I could put the code so the community can use it ?

Cheers,
Iulian

---------- Forwarded message ----------
From: Matthias Berth <[hidden email]>
Date: Tue, Jul 22, 2008 at 7:10 PM
Subject: Re: [Newbies] Skewing Forms in Squeak V2
To: "A friendly place to get answers to even the most basic questions about Squeak." <[hidden email]>


So it comes down to this:

given a projective transformation T from a rectangle (your form) to a
quad Q (what you want to draw on screen), how can you express the same
transformation in terms of mapping a quad to a rectangle (what WarpBlt
needs)?

One possible plan is:

1) determine the transformation's parameters

2) take the bounding box of Q (a rectangle R) and transform it by the
inverse of T, giving you a quad Q'

3) use WarpBlt to transform pixels in Q' (should be a superset of your
form) to R

4) mask the result with your original quad Q, using pixel-by-pixel
operations on Forms

I think all you need in terms of mathematics for this is in
http://www.cs.cmu.edu/~ph/869/www/notes/proj/proj.pdf

Hope this helps, feel free to ask about the details,

Matthias




On Thu, Jul 24, 2008 at 1:39 AM, Yoshiki Ohshima <[hidden email]> wrote:
At Tue, 22 Jul 2008 13:53:21 -0400,
Iulian Wande Radu wrote:
>
> Hi, I'd like to skew the graphics of a Form, is there an easy way to do this in v2 ?
>
> What I want is to take the rectangle from a normal form, transform it into an arbitrarily-defined quadrilateral, and
> then paint on the screen. I saw that WarpBlt does something like this.. but it maps a quadrilateral section of a form
> onto a rectangle.

 There was similar a discussion on this a while ago:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-February/013402.html

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Matthias Berth-2
Hi Iulian,

I'm glad to hear that it worked for you. I wonder why you implemented
it in a C DLL... As far as I can see, the manipulations with the
parameters would be done only once for every quad you want to
transform. The computation time for that should be negligible compared
to the time it takes to actually transform all the pixels in the quad
/ rectangle. At least that's what I was thinking, maybe i am wrong?

Cheers

Matthias

On Tue, Sep 23, 2008 at 1:08 AM, Iulian Wande Radu
<[hidden email]> wrote:

> Thank you for the guidelines for skewing forms.
>
> I've followed Matthias' instructions (and the associated math doc) and
> skewing works well this way through WarpBlt. (The code linked by Yoshiki was
> too slow and didn't work fully).
>
> I wrote the math conversions in a C DLL, and it would probably be useful for
> people. Is there any place where I could put the code so the community can
> use it ?
>
> Cheers,
> Iulian
>
> ---------- Forwarded message ----------
> From: Matthias Berth <[hidden email]>
> Date: Tue, Jul 22, 2008 at 7:10 PM
> Subject: Re: [Newbies] Skewing Forms in Squeak V2
> To: "A friendly place to get answers to even the most basic questions about
> Squeak." <[hidden email]>
>
>
> So it comes down to this:
>
> given a projective transformation T from a rectangle (your form) to a
> quad Q (what you want to draw on screen), how can you express the same
> transformation in terms of mapping a quad to a rectangle (what WarpBlt
> needs)?
>
> One possible plan is:
>
> 1) determine the transformation's parameters
>
> 2) take the bounding box of Q (a rectangle R) and transform it by the
> inverse of T, giving you a quad Q'
>
> 3) use WarpBlt to transform pixels in Q' (should be a superset of your
> form) to R
>
> 4) mask the result with your original quad Q, using pixel-by-pixel
> operations on Forms
>
> I think all you need in terms of mathematics for this is in
> http://www.cs.cmu.edu/~ph/869/www/notes/proj/proj.pdf
>
> Hope this helps, feel free to ask about the details,
>
> Matthias
>
>
>
>
> On Thu, Jul 24, 2008 at 1:39 AM, Yoshiki Ohshima <[hidden email]> wrote:
>>
>> At Tue, 22 Jul 2008 13:53:21 -0400,
>> Iulian Wande Radu wrote:
>> >
>> > Hi, I'd like to skew the graphics of a Form, is there an easy way to do
>> > this in v2 ?
>> >
>> > What I want is to take the rectangle from a normal form, transform it
>> > into an arbitrarily-defined quadrilateral, and
>> > then paint on the screen. I saw that WarpBlt does something like this..
>> > but it maps a quadrilateral section of a form
>> > onto a rectangle.
>>
>>  There was similar a discussion on this a while ago:
>>
>>
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-February/013402.html
>>
>> -- Yoshiki
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Skewing Forms in Squeak V2

Iulian Wande Radu
You're right about the timing.
I'm fairly new to Smalltalk and had already hooked in a DLL for other things, so found it much easier to work matrix math in C :)

On Mon, Sep 22, 2008 at 7:58 PM, Matthias Berth <[hidden email]> wrote:
Hi Iulian,

I'm glad to hear that it worked for you. I wonder why you implemented
it in a C DLL... As far as I can see, the manipulations with the
parameters would be done only once for every quad you want to
transform. The computation time for that should be negligible compared
to the time it takes to actually transform all the pixels in the quad
/ rectangle. At least that's what I was thinking, maybe i am wrong?

Cheers

Matthias

On Tue, Sep 23, 2008 at 1:08 AM, Iulian Wande Radu
> Thank you for the guidelines for skewing forms.
>
> I've followed Matthias' instructions (and the associated math doc) and
> skewing works well this way through WarpBlt. (The code linked by Yoshiki was
> too slow and didn't work fully).
>
> I wrote the math conversions in a C DLL, and it would probably be useful for
> people. Is there any place where I could put the code so the community can
> use it ?
>
> Cheers,
> Iulian
>
> ---------- Forwarded message ----------
> From: Matthias Berth <[hidden email]>
> Date: Tue, Jul 22, 2008 at 7:10 PM
> Subject: Re: [Newbies] Skewing Forms in Squeak V2
> To: "A friendly place to get answers to even the most basic questions about
> Squeak." <[hidden email]>
>
>
> So it comes down to this:
>
> given a projective transformation T from a rectangle (your form) to a
> quad Q (what you want to draw on screen), how can you express the same
> transformation in terms of mapping a quad to a rectangle (what WarpBlt
> needs)?
>
> One possible plan is:
>
> 1) determine the transformation's parameters
>
> 2) take the bounding box of Q (a rectangle R) and transform it by the
> inverse of T, giving you a quad Q'
>
> 3) use WarpBlt to transform pixels in Q' (should be a superset of your
> form) to R
>
> 4) mask the result with your original quad Q, using pixel-by-pixel
> operations on Forms
>
> I think all you need in terms of mathematics for this is in
> http://www.cs.cmu.edu/~ph/869/www/notes/proj/proj.pdf
>
> Hope this helps, feel free to ask about the details,
>
> Matthias
>
>
>
>
> On Thu, Jul 24, 2008 at 1:39 AM, Yoshiki Ohshima <[hidden email]> wrote:
>>
>> At Tue, 22 Jul 2008 13:53:21 -0400,
>> Iulian Wande Radu wrote:
>> >
>> > Hi, I'd like to skew the graphics of a Form, is there an easy way to do
>> > this in v2 ?
>> >
>> > What I want is to take the rectangle from a normal form, transform it
>> > into an arbitrarily-defined quadrilateral, and
>> > then paint on the screen. I saw that WarpBlt does something like this..
>> > but it maps a quadrilateral section of a form
>> > onto a rectangle.
>>
>>  There was similar a discussion on this a while ago:
>>
>>
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-February/013402.html
>>
>> -- Yoshiki
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners