librelist archives

« back to archive

Imaging model

Imaging model

From:
Bruce Perens
Date:
2014-11-20 @ 18:39
<html style="direction: ltr;">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; }
</style>
  </head>
  <body style="direction: ltr;" bidimailui-charset-is-forced="true"
    bgcolor="#FFFFFF" text="#000000">
    I'm a little confused regarding the Shoes imaging model. Most modern
    drawing environments take the overall model from Postscript, in
    particular the Current Transformation Matrix and its manipulations.
    In such an imaging model rotate, scale, and translate change the
    global CTM and effect all subsequent drawing operations.
    Event-related coordinates are mapped through the reverse of the CTM.
    _why does't say much about the imaging model in <i>NKS</i> and
    whoever wrote <i>The Rules of Shoes</i> doesn't either, and in
    particular there's no access to the CTM and no reverse-mapping for
    events.<br>
    <br>
    All of this makes it more difficult when I attempt to construct
    non-native controls. Having built a horizontal slider, making it
    vertical should be just rotate. But it's not.<br>
    <br>
        Thanks<br>
    <br>
        Bruce<br>
  </body>
</html>

Re: Imaging model

From:
Bruce Perens
Date:
2014-11-20 @ 18:42
Oops. I guess I had "Rich Text Only" turned on.

On 11/20/2014 10:39 AM, Bruce Perens wrote:
> I'm a little confused regarding the Shoes imaging model. Most modern 
> drawing environments take the overall model from Postscript, in 
> particular the Current Transformation Matrix and its manipulations. In 
> such an imaging model rotate, scale, and translate change the global 
> CTM and effect all subsequent drawing operations. Event-related 
> coordinates are mapped through the reverse of the CTM. _why does't say 
> much about the imaging model in /NKS/ and whoever wrote /The Rules of 
> Shoes/ doesn't either, and in particular there's no access to the CTM 
> and no reverse-mapping for events.
>
> All of this makes it more difficult when I attempt to construct 
> non-native controls. Having built a horizontal slider, making it 
> vertical should be just rotate. But it's not.
>
>     Thanks
>
>     Bruce

Re: [shoes] Re: Imaging model

From:
Cecil Coupe
Date:
2014-11-21 @ 04:44
Bruce,

    In Shoes 3, the code is Cairo (and cairopango). The reason nothing 
is said about imaging models and similar issues is because Shoes wasn't 
written for that level of interaction (or skill level). The code doesn't 
exist so no one wrote about missing features.

   I can't speak for how Shoes 4 replaced cairo (my assumption) but I'm 
pretty sure they stayed with the simple Shoes scheme for backwards 
compatibility.

--Cecil
On 11/20/2014 11:42 AM, Bruce Perens wrote:
> Oops. I guess I had "Rich Text Only" turned on.
>
> On 11/20/2014 10:39 AM, Bruce Perens wrote:
>> I'm a little confused regarding the Shoes imaging model. Most modern 
>> drawing environments take the overall model from Postscript, in 
>> particular the Current Transformation Matrix and its manipulations. 
>> In such an imaging model rotate, scale, and translate change the 
>> global CTM and effect all subsequent drawing operations. 
>> Event-related coordinates are mapped through the reverse of the CTM. 
>> _why does't say much about the imaging model in /NKS/ and whoever 
>> wrote /The Rules of Shoes/ doesn't either, and in particular there's 
>> no access to the CTM and no reverse-mapping for events.
>>
>> All of this makes it more difficult when I attempt to construct 
>> non-native controls. Having built a horizontal slider, making it 
>> vertical should be just rotate. But it's not.
>>
>>     Thanks
>>
>>     Bruce
>

Re: [shoes] Re: Imaging model

From:
Bruce Perens
Date:
2014-11-21 @ 05:29
On 11/20/2014 08:44 PM, Cecil Coupe wrote:
> Bruce,
>
> The reason nothing is said about imaging models and similar issues is 
> because Shoes wasn't written for that level of interaction (or skill 
> level).

OK, I guess I am somewhat sophisticated, but I was a systems programmer 
at Pixar, not a graphics programmer. And I met this issue on my first 
real Shoes program.

So, what I seem to be getting on Shoes 4.0 is that all objects rotate 
independently instead of the /canvas/ rotating around its origin. So, if 
I put a "rotate 90" before my slider drawing, the pieces that were 
together before end up at their previous horizontal positions but 
rotated, and thus the pieces of the drawing are now some distance from 
each other.

I think what we really want here is simplicity /with depth. /Meaning 
that you don't have to know about the imaging model but it's /defined/ 
and generally does the right thing. I am not clear that it would do the 
same thing on different Shoes implementations at present.

     Thanks

     Bruce

Re: [shoes] Re: Imaging model

From:
Cecil Coupe
Date:
2014-11-21 @ 05:43
Without a code sample, I can't tell you what 3.2 does with it or what 
might work better. You can file a bug or a feature request. Shoes and 
custom widgets (in Shoes) is pushing the edge of what Shoes was designed 
to do.

--Cecil

On 11/20/2014 10:29 PM, Bruce Perens wrote:
> On 11/20/2014 08:44 PM, Cecil Coupe wrote:
>> Bruce,
>>
>> The reason nothing is said about imaging models and similar issues is 
>> because Shoes wasn't written for that level of interaction (or skill 
>> level).
>
> OK, I guess I am somewhat sophisticated, but I was a systems 
> programmer at Pixar, not a graphics programmer. And I met this issue 
> on my first real Shoes program.
>
> So, what I seem to be getting on Shoes 4.0 is that all objects rotate 
> independently instead of the /canvas/ rotating around its origin. So, 
> if I put a "rotate 90" before my slider drawing, the pieces that were 
> together before end up at their previous horizontal positions but 
> rotated, and thus the pieces of the drawing are now some distance from 
> each other.
>
> I think what we really want here is simplicity /with depth. /Meaning 
> that you don't have to know about the imaging model but it's /defined/ 
> and generally does the right thing. I am not clear that it would do 
> the same thing on different Shoes implementations at present.
>
>     Thanks
>
>     Bruce

Re: [shoes] Re: Imaging model

From:
Bruce Perens
Date:
2014-11-21 @ 05:48
You're right of course. I will compare 3.2 and 4.0 preview and send you 
guys some samples.

     Thanks

     Bruce


On 11/20/2014 09:43 PM, Cecil Coupe wrote:
> Without a code sample, I can't tell you what 3.2 does with it or what 
> might work better. You can file a bug or a feature request. Shoes and 
> custom widgets (in Shoes) is pushing the edge of what Shoes was 
> designed to do.
>
> --Cecil
>
> On 11/20/2014 10:29 PM, Bruce Perens wrote:
>> On 11/20/2014 08:44 PM, Cecil Coupe wrote:
>>> Bruce,
>>>
>>> The reason nothing is said about imaging models and similar issues 
>>> is because Shoes wasn't written for that level of interaction (or 
>>> skill level).
>>
>> OK, I guess I am somewhat sophisticated, but I was a systems 
>> programmer at Pixar, not a graphics programmer. And I met this issue 
>> on my first real Shoes program.
>>
>> So, what I seem to be getting on Shoes 4.0 is that all objects rotate 
>> independently instead of the /canvas/ rotating around its origin. So, 
>> if I put a "rotate 90" before my slider drawing, the pieces that were 
>> together before end up at their previous horizontal positions but 
>> rotated, and thus the pieces of the drawing are now some distance 
>> from each other.
>>
>> I think what we really want here is simplicity /with depth. /Meaning 
>> that you don't have to know about the imaging model but it's 
>> /defined/ and generally does the right thing. I am not clear that it 
>> would do the same thing on different Shoes implementations at present.
>>
>>     Thanks
>>
>>     Bruce
>

Re: [shoes] Re: Imaging model

From:
Tobias Pfeiffer
Date:
2014-11-21 @ 09:51
Hi Bruce,

samples are much appreciated! :)

Shoes was mainly written for beginners and simplicity. I do agree that 
simplicity with depth is something that would be great to aim for. I know 
we have some rotate methods... if they don't do what you'd expect them to 
do file an issue and we can try to figure stuff out.

I must say that none of us, that I know of, have a background in GUI 
programming. Most of us are here because we love shoes and kind of learn 
the GUI stuff on the side. Shoes 4 uses SWT (http://www.eclipse.org/swt/) 
beneath the covers. I trust SWT to be mature and do the right thing, so in
a lot of cases it is just a question of providing the right interface to 
SWT and the Shoes DSL objects picking up the right values. If you want you
can always get a hold of the real SWT objects, if you want to manipulate 
them correctly. That is highly implementation, though.

Thanks for your email and the PDF!

Cheers,
Tobi
On 21.11.2014 06:48, Bruce Perens wrote:
> You're right of course. I will compare 3.2 and 4.0 preview and send you
> guys some samples.
>
>     Thanks
>
>     Bruce
>
>
> On 11/20/2014 09:43 PM, Cecil Coupe wrote:
> > Without a code sample, I can't tell you what 3.2 does with it or what
> > might work better. You can file a bug or a feature request.  Shoes and
> > custom widgets (in Shoes) is pushing the edge of what Shoes was
> > designed to do.
> >
> > --Cecil
> >
> > On 11/20/2014 10:29 PM, Bruce Perens wrote:
> >> On 11/20/2014 08:44 PM, Cecil Coupe wrote:
> >>> Bruce,
> >>>
> >>> The reason nothing is said about imaging models and similar issues
> >>> is because Shoes wasn't written for that level of interaction (or
> >>> skill level).
> >>
> >> OK, I guess I am somewhat sophisticated, but I was a systems
> >> programmer at Pixar, not a graphics programmer. And I met this issue
> >> on my first real Shoes program.
> >>
> >> So, what I seem to be getting on Shoes 4.0 is that all objects rotate
> >> independently instead of the /canvas/ rotating around its origin. So,
> >> if I put a "rotate 90" before my slider drawing, the pieces that were
> >> together before end up at their previous horizontal positions but
> >> rotated, and thus the pieces of the drawing are now some distance
> >> from each other.
> >>
> >> I think what we really want here is simplicity /with depth. /Meaning
> >> that you don't have to know about the imaging model but it's
> >> /defined/ and generally does the right thing. I am not clear that it
> >> would do the same thing on different Shoes implementations at present.
> >>
> >>     Thanks
> >>
> >>     Bruce
> >
>

-- 
www.pragtob.info

Re: [shoes] Re: Imaging model

From:
Bruce Perens
Date:
2014-11-21 @ 20:13
Well, Shoes 3 and Shoes 4 do exactly the same thing. And rotate doesn't 
apply to native controls at all, because they aren't really graphical 
objects.

There is a lot of fixing that could be done to the Shoes imaging model. 
The result wouldn't be Shoes, though. It's probably worth making, I'll 
put it on my queue and perhaps someday get to it.

Consider that flows and stacks could be their own canvases, each with an 
internal origin at 0,0 and a matrix that positioned them in the 
surrounding stack or flow. They could be translated, rotated, and scaled 
as other graphical objects and would still behave properly as flows and 
stacks. And IMO a lot of the complexity of the internals of layout that 
is awkward now would fall out.

This would require that all controls be capable of being rendered 
through a transformation matrix, though. And otherwise treated as any 
graphical object. Which probably rules out many native control 
libraries. It fits non-native ones really well, though.

     Thanks

     Bruce

On 11/21/2014 01:51 AM, Tobias Pfeiffer wrote:
> Hi Bruce,
>
> samples are much appreciated! :)
>
> Shoes was mainly written for beginners and simplicity. I do agree that 
simplicity with depth is something that would be great to aim for. I know 
we have some rotate methods... if they don't do what you'd expect them to 
do file an issue and we can try to figure stuff out.

Re: [shoes] Re: Imaging model

From:
Bruce Perens
Date:
2014-11-21 @ 05:46
Anyone who wants to know about imaging models should read
https://www.adobe.com/products/postscript/pdfs/PLRM.pdf
Specifically the chapter starting at Page 175.

I am innumerate by the standard of most of you and have never taken a 
computer science course or any math beyond algebra. However, I actually 
learned matrix algebra and a complete and logical 2D imaging model from 
this chapter back in the '80's. Which is nothing short of amazing. It is 
highly recommended.

     Thanks

     Bruce