VW graphical look [Was: Re: MacOS X]

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

Re: VW graphical look [Was: Re: MacOS X]

Travis Griggs-3
On May 24, 2007, at 9:47, Boris Popov wrote:

I was one of the people that originally tried to create a compatible display context that used cairo backend, and honestly I’ve only gotten as far as displaying lines and rectangles and bitmaps. Nonetheless, I’m curious myself as to what exactly makes it impossible to continue down that path and get immediate benefits of much nicer looking paths and text versus having to create whole new looks that use cairo-specific API? I don’t yet buy the generic “it’s very different” excuse, people fit propane engines in gasoline cars all the time, but like I say I probably just haven’t gone far enough yet, hence me asking for specifics ;)

OK then, it _was_ four. :)

Knowing what I know today, this seems both more possible and yet harder than before. Here's how I'd tackle the problem today.

Create a subclass of ScreenGraphicsContext. Add a lazy created instance variable for the cairo context. Send carioContext to self to get it. In this way, it uses all of the original implementation, and you can begin to override methods on a case by case basis to do it with Cairo. You're never going to try and replace the text stuff. The other VW text objects are just too intertwined.

Some problems still have to be solved though. Two come to mind:

1) The coordinate systems don't match (see page 32 of the presentation). You'll basically have to do "interesting" things with the stroke width and add 0.5 to all "stroke" operations to get them to do what VW currently does. If you don't do this... you're lines will all look shifted. Or maybe you just leave strokeWidth at 2.
2) Arcs. VW does the draw some degrees of an arc (filled or not) as contained by a bounding box. Cairo doesn't have this sort of API. It uses Beziers. It has short cuts for setting up perfectly circular arcs. So what you have to do to get these with Cairo is either a) figure out how to translate the bounding box defined arcs as beziers and do the math for that yourself or b) use the cairo circular arc APIs, but use the transform to get it to match the aspect ratio of the bounding box (this is how the OSX VM has to do it, since it has the same problem). You of course have to make the 0.5 adjustments when you're dealing with stroking. But make sure you reset the matrix before you actually stroke, otherwise you'll skew the stroke width.

Someone could do this. At one point, I wanted to. Somewhere past that, I migrated from camp #1 to camp #2 (see previous email).

It's fun to ponder the possibilities with such a thing. If you wanted to draw a Bezier, you'd create the VW Bezier object. You may or may not have to futz with it's "flatness". When you displayed it with your "don't have to change anything GC", it would do all of the bezier math in VW. Then it would draw a polyline with lots of short teensy flat lines to approximate the curve. It'd feed it through the GC displayPolyline:at: method. Which would adjust all of them by 0.5 and draw it. If you wanted to draw it really thick, like 20 pixels, you might even see the artifacts of drying it as a list of line segments.

Or you could just use the Cairo bezier API which tessellates the edges of the arc. And looks really good always. And all goes really fast.

--
Travis Griggs
Objologist
"Is success the potential of what could be, or the reality of what is?"


Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Steven Kelly
In reply to this post by Steven Kelly
Message
 
From: Travis Griggs [mailto:[hidden email]]
Upon reflection (and a nice walk-n-talk to the local Subway), I think the synopsis of this discussion might be boiled down to two viewpoints:

1) I'm fine with the VW GC API, but want what it does to be done better.
2) The VW GC API is old fashioned, I don't care how it does what it does, but I want an API that does more things.

There are some overlaps surely. To date, those of us who have been playing with Cairo are probably more in the #2 camp. 
Brilliant analysis! And many thanks for keeping this discussion calm.
 
I've been talking here about camp #1. We all have a lot of stuff existing at a high level, built on the low-level VW GC API. If we throw that API away, we're reduced to moving all that existing stuff to work on the new API, which is at a substantially lower level than we are used to. Or then we have to re-build the graphics layers on top of Cairo, so we can work at a high level again. Either way, a lot of work. I think camp #1 is better served by a solution that keeps the old API but adds anti-aliasing and alpha. Changing a couple of lines of C in the VM, and linking to GDI+ rather than GDI, may be a good solution to get this working on Windows. (OK, so it will be more complicated than that, but you hopefully get the point.)
 
I'm all in favour of the many extra Cairo features. We need them more than many people, as we are building a graphical modeling tool. I wrote pure Smalltalk implementations of gradient, radial, square and path fills, with multiple color points. Optimizing that so you can directly edit the angles and color points of the fills in real time was fun, but hard enough that I'm happy if I don't have to keep doing things like that. Being able to do Cairo drawing (with low-level calls) to a VW GraphicsContext may be a good solution for this.
 
Steve
Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Eliot Miranda-2
Steve,

    basically the VM code is at completely the wrong level.  By putting things down in the VM

- the VM has to mantain a complicated and ineffective cache of the last graphics context used so that it doesn't have to rebuild the OS's graphics context from it on every primitive operation.  In any case it has to do significant work to verify the cache is valid (compare lots of state in the VM's cached GC ith the image-level GC) and then update the cached GC with whatever may have changed.

- the VM code is inaccessible, not extensible, relatively hard to mantain, not shared between platforms, and is C.

The only advantages the VM code has are
- allows the VI code to be platform-independent (and this is increassingly a dubious benefit right?)
- allows certain operations to benefit from C speed (e.g. characer string writing where it has to be composed out of writing individual characters)
- its easy to enfore platform independence because the VM mediates all graphics access

If work is put into the FFI then the speed advantage goes away.  Having an image-leve implementation allows direct use of an OS GC with no need for the VM cache, allows the VI to get to whatever extensions the platform provides easily, allows the VI to implement platform-independent fallback code in Smalltalk instead of costly buggy C.  Platform-independence can be maintained using a test suite.

Essentially moving the whole ball of wax up to the image will result in something that can evolve much faster and be maintained much more cheaply.  But to do this the initial hump of implementing the existing facilities in Smalltalk for three plaforms must be traversed.

On 5/24/07, Steven Kelly <[hidden email]> wrote:
 
From: Travis Griggs [mailto:[hidden email]]
Upon reflection (and a nice walk-n-talk to the local Subway), I think the synopsis of this discussion might be boiled down to two viewpoints:

1) I'm fine with the VW GC API, but want what it does to be done better.
2) The VW GC API is old fashioned, I don't care how it does what it does, but I want an API that does more things.

There are some overlaps surely. To date, those of us who have been playing with Cairo are probably more in the #2 camp. 
Brilliant analysis! And many thanks for keeping this discussion calm.
 
I've been talking here about camp #1. We all have a lot of stuff existing at a high level, built on the low-level VW GC API. If we throw that API away, we're reduced to moving all that existing stuff to work on the new API, which is at a substantially lower level than we are used to. Or then we have to re-build the graphics layers on top of Cairo, so we can work at a high level again. Either way, a lot of work. I think camp #1 is better served by a solution that keeps the old API but adds anti-aliasing and alpha. Changing a couple of lines of C in the VM, and linking to GDI+ rather than GDI, may be a good solution to get this working on Windows. (OK, so it will be more complicated than that, but you hopefully get the point.)
 
I'm all in favour of the many extra Cairo features. We need them more than many people, as we are building a graphical modeling tool. I wrote pure Smalltalk implementations of gradient, radial, square and path fills, with multiple color points. Optimizing that so you can directly edit the angles and color points of the fills in real time was fun, but hard enough that I'm happy if I don't have to keep doing things like that. Being able to do Cairo drawing (with low-level calls) to a VW GraphicsContext may be a good solution for this.
 
Steve

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Carl Gundel
This is a very good way to do it.  One successful implementation is
VisualSmalltalk with an OS/2 and a Windows version.  In this flavor of
Smalltalk all the graphics and windowing code is handled in the image
and written in Smalltalk.  Applications are easily portable between
Windows and OS/2, though not binary compatible.

-Carl Gundel
http://www.libertybasic.com

Subject: Re: VW graphical look [Was: Re: MacOS X]


> Steve,
>
>     basically the VM code is at completely the wrong level.  By
putting
> things down in the VM
>
> - the VM has to mantain a complicated and ineffective cache of the
last
> graphics context used so that it doesn't have to rebuild the OS's
graphics
> context from it on every primitive operation.  In any case it has to
do
> significant work to verify the cache is valid (compare lots of state
in the
> VM's cached GC ith the image-level GC) and then update the cached GC
with
> whatever may have changed.
>
> - the VM code is inaccessible, not extensible, relatively hard to
mantain,
> not shared between platforms, and is C.
>
> The only advantages the VM code has are
> - allows the VI code to be platform-independent (and this is
increassingly a
> dubious benefit right?)
> - allows certain operations to benefit from C speed (e.g. characer
string
> writing where it has to be composed out of writing individual
characters)
> - its easy to enfore platform independence because the VM mediates all
> graphics access
>
> If work is put into the FFI then the speed advantage goes away.
Having an
> image-leve implementation allows direct use of an OS GC with no need
for the
> VM cache, allows the VI to get to whatever extensions the platform
provides
> easily, allows the VI to implement platform-independent fallback code
in
> Smalltalk instead of costly buggy C.  Platform-independence can be
> maintained using a test suite.
>
> Essentially moving the whole ball of wax up to the image will result
in
> something that can evolve much faster and be maintained much more
cheaply.
> But to do this the initial hump of implementing the existing
facilities in
> Smalltalk for three plaforms must be traversed.
>
> On 5/24/07, Steven Kelly <[hidden email]> wrote:
> >
> >
> >
> >  *From:* Travis Griggs [mailto:[hidden email]]
> > Upon reflection (and a nice walk-n-talk to the local Subway), I
think the
> > synopsis of this discussion might be boiled down to two viewpoints:
> > 1) I'm fine with the VW GC API, but want what it does to be done
better.
> > 2) The VW GC API is old fashioned, I don't care how it does what it
does,
> > but I want an API that does more things.
> >
> > There are some overlaps surely. To date, those of us who have been
playing
> > with Cairo are probably more in the #2 camp.
> >
> > Brilliant analysis! And many thanks for keeping this discussion
calm.
> >
> > I've been talking here about camp #1. We all have a lot of stuff
existing
> > at a high level, built on the low-level VW GC API. If we throw that
API
> > away, we're reduced to moving all that existing stuff to work on the
new
> > API, which is at a substantially lower level than we are used to. Or
then we
> > have to re-build the graphics layers on top of Cairo, so we can work
at a
> > high level again. Either way, a lot of work. I think camp #1 is
better
> > served by a solution that keeps the old API but adds anti-aliasing
and
> > alpha. Changing a couple of lines of C in the VM, and linking to
GDI+ rather
> > than GDI, may be a good solution to get this working on Windows.
(OK, so it
> > will be more complicated than that, but you hopefully get the
point.)
> >
> > I'm all in favour of the many extra Cairo features. We need them
more than
> > many people, as we are building a graphical modeling tool. I wrote
pure
> > Smalltalk implementations of gradient, radial, square and path
fills, with
> > multiple color points. Optimizing that so you can directly edit the
angles
> > and color points of the fills in real time was fun, but hard enough
that I'm
> > happy if I don't have to keep doing things like that. Being able to
do Cairo
> > drawing (with low-level calls) to a VW GraphicsContext may be a good
> > solution for this.
> >
> > Steve
> >
>


Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Eliot Miranda-2
Another existence proof was the defunct Van Gogh native GUI project inside ParcPlace that got axed as party of the PP-D merger.  They had image-level graphics implementations for Windows and Mac OS classic and were working on X11.  Apparently in 1995 the Mac implementation was within a cou8ple of percent of performance of the VM.

On 5/24/07, Carl Gundel <[hidden email]> wrote:
This is a very good way to do it.  One successful implementation is
VisualSmalltalk with an OS/2 and a Windows version.  In this flavor of
Smalltalk all the graphics and windowing code is handled in the image
and written in Smalltalk.  Applications are easily portable between
Windows and OS/2, though not binary compatible.

-Carl Gundel
http://www.libertybasic.com

Subject: Re: VW graphical look [Was: Re: MacOS X]


> Steve,
>
>     basically the VM code is at completely the wrong level.  By
putting
> things down in the VM
>
> - the VM has to mantain a complicated and ineffective cache of the
last
> graphics context used so that it doesn't have to rebuild the OS's
graphics
> context from it on every primitive operation.  In any case it has to
do
> significant work to verify the cache is valid (compare lots of state
in the
> VM's cached GC ith the image-level GC) and then update the cached GC
with
> whatever may have changed.
>
> - the VM code is inaccessible, not extensible, relatively hard to
mantain,
> not shared between platforms, and is C.
>
> The only advantages the VM code has are
> - allows the VI code to be platform-independent (and this is
increassingly a
> dubious benefit right?)
> - allows certain operations to benefit from C speed (e.g. characer
string
> writing where it has to be composed out of writing individual
characters)
> - its easy to enfore platform independence because the VM mediates all
> graphics access
>
> If work is put into the FFI then the speed advantage goes away.
Having an
> image-leve implementation allows direct use of an OS GC with no need
for the
> VM cache, allows the VI to get to whatever extensions the platform
provides
> easily, allows the VI to implement platform-independent fallback code
in
> Smalltalk instead of costly buggy C.  Platform-independence can be
> maintained using a test suite.
>
> Essentially moving the whole ball of wax up to the image will result
in
> something that can evolve much faster and be maintained much more
cheaply.
> But to do this the initial hump of implementing the existing
facilities in
> Smalltalk for three plaforms must be traversed.
>
> On 5/24/07, Steven Kelly <[hidden email]> wrote:
> >
> >
> >
> >  *From:* Travis Griggs [mailto:[hidden email]]
> > Upon reflection (and a nice walk-n-talk to the local Subway), I
think the
> > synopsis of this discussion might be boiled down to two viewpoints:
> > 1) I'm fine with the VW GC API, but want what it does to be done
better.
> > 2) The VW GC API is old fashioned, I don't care how it does what it
does,
> > but I want an API that does more things.
> >
> > There are some overlaps surely. To date, those of us who have been
playing
> > with Cairo are probably more in the #2 camp.
> >
> > Brilliant analysis! And many thanks for keeping this discussion
calm.
> >
> > I've been talking here about camp #1. We all have a lot of stuff
existing
> > at a high level, built on the low-level VW GC API. If we throw that
API
> > away, we're reduced to moving all that existing stuff to work on the
new
> > API, which is at a substantially lower level than we are used to. Or
then we
> > have to re-build the graphics layers on top of Cairo, so we can work
at a
> > high level again. Either way, a lot of work. I think camp #1 is
better
> > served by a solution that keeps the old API but adds anti-aliasing
and
> > alpha. Changing a couple of lines of C in the VM, and linking to
GDI+ rather
> > than GDI, may be a good solution to get this working on Windows.
(OK, so it
> > will be more complicated than that, but you hopefully get the
point.)
> >
> > I'm all in favour of the many extra Cairo features. We need them
more than
> > many people, as we are building a graphical modeling tool. I wrote
pure
> > Smalltalk implementations of gradient, radial, square and path
fills, with
> > multiple color points. Optimizing that so you can directly edit the
angles
> > and color points of the fills in real time was fun, but hard enough
that I'm
> > happy if I don't have to keep doing things like that. Being able to
do Cairo
> > drawing (with low-level calls) to a VW GraphicsContext may be a good
> > solution for this.
> >
> > Steve
> >
>



Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Andre Schnoor
In reply to this post by Travis Griggs-3
Travis Griggs wrote:
> 1) I'm fine with the VW GC API, but want what it does to be done better.
> 2) The VW GC API is old fashioned, I don't care how it does what it
> does, but I want an API that does more things.
>
I'd like to add one:

3) I'm fine with the current GC API, but need speed, speed and speed

Sure, beauty is nice to have and will sell better, but if a product
doesn't perform at all, it's a business killer. An expensive commercial
desktop software showing horrible response times (10+ seconds at times)
won't survive the first trade show and press review, let alone the
competition. In a market dominated by word-of-mouth and buzzword voodoo,
there is no such thing like a second chance ("Buy now, get a usable
product next year"). It would probably save more money and be less
frustrating to shut down the company right away.

I mean, if it runs fine on Windows (and it really does), there MUST be a
way to achieve equal results on OS X. I'm afraid however, there is no
alternative to digging into the VM, taking another expensive learning
curve and fix it myself.

Andre

Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Steven Kelly
In reply to this post by Steven Kelly
Message
Eliot,
 
I'm all for it. And for more advanced graphics operations. But not today :-).
 
Having seen what happened with Pollock, I'm not particularly confident about schedules for major changes in VW. We need things like dotted lines, anti-aliasing and alpha now. We may also like masking to an arbitrary polygon, and fountain fills, but we don't want to wait several years to get the simpler stuff. That's why I've had to implement dotted lines, masking and fountain fills by hand in Smalltalk. I'd do anti-aliasing and alpha, but they require working at the individual pixel level, and the slowness there is prohibitive.
 
Cheers,
Steve
-----Original Message-----
From: Eliot Miranda [mailto:[hidden email]]
Sent: 25. toukokuuta 2007 1:10
To: Steven Kelly
Cc: vwnc
Subject: Re: VW graphical look [Was: Re: MacOS X]

Steve,

    basically the VM code is at completely the wrong level.  By putting things down in the VM

- the VM has to mantain a complicated and ineffective cache of the last graphics context used so that it doesn't have to rebuild the OS's graphics context from it on every primitive operation.  In any case it has to do significant work to verify the cache is valid (compare lots of state in the VM's cached GC ith the image-level GC) and then update the cached GC with whatever may have changed.

- the VM code is inaccessible, not extensible, relatively hard to mantain, not shared between platforms, and is C.

The only advantages the VM code has are
- allows the VI code to be platform-independent (and this is increassingly a dubious benefit right?)
- allows certain operations to benefit from C speed (e.g. characer string writing where it has to be composed out of writing individual characters)
- its easy to enfore platform independence because the VM mediates all graphics access

If work is put into the FFI then the speed advantage goes away.  Having an image-leve implementation allows direct use of an OS GC with no need for the VM cache, allows the VI to get to whatever extensions the platform provides easily, allows the VI to implement platform-independent fallback code in Smalltalk instead of costly buggy C.  Platform-independence can be maintained using a test suite.

Essentially moving the whole ball of wax up to the image will result in something that can evolve much faster and be maintained much more cheaply.  But to do this the initial hump of implementing the existing facilities in Smalltalk for three plaforms must be traversed.

On 5/24/07, Steven Kelly <[hidden email]> wrote:
 
From: Travis Griggs [mailto:[hidden email]]
Upon reflection (and a nice walk-n-talk to the local Subway), I think the synopsis of this discussion might be boiled down to two viewpoints:

1) I'm fine with the VW GC API, but want what it does to be done better.
2) The VW GC API is old fashioned, I don't care how it does what it does, but I want an API that does more things.

There are some overlaps surely. To date, those of us who have been playing with Cairo are probably more in the #2 camp. 
Brilliant analysis! And many thanks for keeping this discussion calm.
 
I've been talking here about camp #1. We all have a lot of stuff existing at a high level, built on the low-level VW GC API. If we throw that API away, we're reduced to moving all that existing stuff to work on the new API, which is at a substantially lower level than we are used to. Or then we have to re-build the graphics layers on top of Cairo, so we can work at a high level again. Either way, a lot of work. I think camp #1 is better served by a solution that keeps the old API but adds anti-aliasing and alpha. Changing a couple of lines of C in the VM, and linking to GDI+ rather than GDI, may be a good solution to get this working on Windows. (OK, so it will be more complicated than that, but you hopefully get the point.)
 
I'm all in favour of the many extra Cairo features. We need them more than many people, as we are building a graphical modeling tool. I wrote pure Smalltalk implementations of gradient, radial, square and path fills, with multiple color points. Optimizing that so you can directly edit the angles and color points of the fills in real time was fun, but hard enough that I'm happy if I don't have to keep doing things like that. Being able to do Cairo drawing (with low-level calls) to a VW GraphicsContext may be a good solution for this.
 
Steve

Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Boris Popov, DeepCove Labs (SNN)
So what are the absolute minimum changes that would make you happy?

1. Adding AA of lines and text
2. Adding proper alpha support
3. What else?

Remember, shorter list == larger chance people will bother to consider
it.

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Steven Kelly [mailto:[hidden email]]
> Sent: Thursday, May 24, 2007 4:29 PM
> To: Eliot Miranda
> Cc: vwnc
> Subject: RE: VW graphical look [Was: Re: MacOS X]
>
> Eliot,
>
> I'm all for it. And for more advanced graphics operations. But not
today
> :-).
>
> Having seen what happened with Pollock, I'm not particularly confident
> about schedules for major changes in VW. We need things like dotted
lines,
> anti-aliasing and alpha now. We may also like masking to an arbitrary
> polygon, and fountain fills, but we don't want to wait several years
to
> get the simpler stuff. That's why I've had to implement dotted lines,
> masking and fountain fills by hand in Smalltalk. I'd do anti-aliasing
and

> alpha, but they require working at the individual pixel level, and the
> slowness there is prohibitive.
>
> Cheers,
> Steve
>
> -----Original Message-----
> From: Eliot Miranda [mailto:[hidden email]]
> Sent: 25. toukokuuta 2007 1:10
> To: Steven Kelly
> Cc: vwnc
> Subject: Re: VW graphical look [Was: Re: MacOS X]
>
>
> Steve,
>
>    basically the VM code is at completely the wrong level.  By
> putting things down in the VM
>
> - the VM has to mantain a complicated and ineffective cache of
the
> last graphics context used so that it doesn't have to rebuild the OS's
> graphics context from it on every primitive operation.  In any case it
has
> to do significant work to verify the cache is valid (compare lots of
state
> in the VM's cached GC ith the image-level GC) and then update the
cached
> GC with whatever may have changed.
>
> - the VM code is inaccessible, not extensible, relatively hard
to
> mantain, not shared between platforms, and is C.
>
> The only advantages the VM code has are
> - allows the VI code to be platform-independent (and this is
> increassingly a dubious benefit right?)
> - allows certain operations to benefit from C speed (e.g.
characer
> string writing where it has to be composed out of writing individual
> characters)
> - its easy to enfore platform independence because the VM
mediates
> all graphics access
>
> If work is put into the FFI then the speed advantage goes away.
> Having an image-leve implementation allows direct use of an OS GC with
no
> need for the VM cache, allows the VI to get to whatever extensions the
> platform provides easily, allows the VI to implement
platform-independent
> fallback code in Smalltalk instead of costly buggy C.  Platform-
> independence can be maintained using a test suite.
>
> Essentially moving the whole ball of wax up to the image will
result

> in something that can evolve much faster and be maintained much more
> cheaply.  But to do this the initial hump of implementing the existing
> facilities in Smalltalk for three plaforms must be traversed.
>
>
> On 5/24/07, Steven Kelly <[hidden email]> wrote:
>
>
>
>
> From: Travis Griggs [mailto:[hidden email] ]
>
> Upon reflection (and a nice walk-n-talk to the
local
> Subway), I think the synopsis of this discussion might be boiled down
to
> two viewpoints:
>
>
> 1) I'm fine with the VW GC API, but want what it
does to
> be done better.
> 2) The VW GC API is old fashioned, I don't care
how it
> does what it does, but I want an API that does more things.
>
>
> There are some overlaps surely. To date, those
of us who
> have been playing with Cairo are probably more in the #2 camp.
>
> Brilliant analysis! And many thanks for keeping this
> discussion calm.
>
> I've been talking here about camp #1. We all have a lot
of
> stuff existing at a high level, built on the low-level VW GC API. If
we
> throw that API away, we're reduced to moving all that existing stuff
to
> work on the new API, which is at a substantially lower level than we
are
> used to. Or then we have to re-build the graphics layers on top of
Cairo,
> so we can work at a high level again. Either way, a lot of work. I
think
> camp #1 is better served by a solution that keeps the old API but adds
> anti-aliasing and alpha. Changing a couple of lines of C in the VM,
and
> linking to GDI+ rather than GDI, may be a good solution to get this
> working on Windows. (OK, so it will be more complicated than that, but
you
> hopefully get the point.)
>
> I'm all in favour of the many extra Cairo features. We
need
> them more than many people, as we are building a graphical modeling
tool.
> I wrote pure Smalltalk implementations of gradient, radial, square and
> path fills, with multiple color points. Optimizing that so you can
> directly edit the angles and color points of the fills in real time
was
> fun, but hard enough that I'm happy if I don't have to keep doing
things
> like that. Being able to do Cairo drawing (with low-level calls) to a
VW
> GraphicsContext may be a good solution for this.
>
> Steve
>

Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Steven Kelly
In reply to this post by Steven Kelly
From: Andre Schnoor [mailto:[hidden email]]
> Travis Griggs wrote:
> > 1) I'm fine with the VW GC API, but want what it does to be done
> > better.
> > 2) The VW GC API is old fashioned, I don't care how it does what it
> > does, but I want an API that does more things.
> >
> I'd like to add one:
>
> 3) I'm fine with the current GC API, but need speed, speed and speed

The speed is fine on Windows and X. I believe those account for the
overwhelming majority of Cincom's VW income.

We support OS X, and have just got things working with 7.5 using a
modification of Lukas Renggli's script that automatically starts up X11
with our app. That may be the way to go for now for some apps. I
understand Andre's customers are the musical Mac crowd, and they'll want
native. From what I've heard, getting a native app to perform well with
the current VI/VM/Aqua graphics architecture is fraught with
difficulties.

Our own app uses graphics intensely, and we haven't had major speed
problems on OS X native, so maybe there's something particular causing
problems in Andre's case?

Steve

Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Steven Kelly
In reply to this post by Steven Kelly
0. Dotted and dashed lines
   - OK, I can live without this, since I have my own

1. Anti-aliasing of Geometrics, with alpha
   - without alpha you can't fill them without problems on the "partial"
pixels

2. Alpha on Images and Masks
   - this could be done in pure Smalltalk, since it's only needed for
things like small toolbar button images that can be cached

3. Alpha on Geometrics
   - this has to be fast enough for the geometrics to be directly
manipulated and update in real time

Steve

> -----Original Message-----
> From: Boris Popov [mailto:[hidden email]]
> Sent: 25. toukokuuta 2007 2:34
> To: Steven Kelly; Eliot Miranda
> Cc: vwnc
> Subject: RE: VW graphical look [Was: Re: MacOS X]
>
>
> So what are the absolute minimum changes that would make you happy?
>
> 1. Adding AA of lines and text
> 2. Adding proper alpha support
> 3. What else?
>
> Remember, shorter list == larger chance people will bother to
> consider it.
>
> Cheers!
>
> -Boris
>
> --
> +1.604.689.0322
> DeepCove Labs Ltd.
> 4th floor 595 Howe Street
> Vancouver, Canada V6C 2T5
> http://tinyurl.com/r7uw4
>
> [hidden email]
>
> CONFIDENTIALITY NOTICE
>
> This email is intended only for the persons named in the
> message header. Unless otherwise indicated, it contains
> information that is private and confidential. If you have
> received it in error, please notify the sender and delete the
> entire message including any attachments.
>
> Thank you.
>
> > -----Original Message-----
> > From: Steven Kelly [mailto:[hidden email]]
> > Sent: Thursday, May 24, 2007 4:29 PM
> > To: Eliot Miranda
> > Cc: vwnc
> > Subject: RE: VW graphical look [Was: Re: MacOS X]
> >
> > Eliot,
> >
> > I'm all for it. And for more advanced graphics operations. But not
> today
> > :-).
> >
> > Having seen what happened with Pollock, I'm not
> particularly confident
> > about schedules for major changes in VW. We need things like dotted
> lines,
> > anti-aliasing and alpha now. We may also like masking to an
> arbitrary
> > polygon, and fountain fills, but we don't want to wait several years
> to
> > get the simpler stuff. That's why I've had to implement
> dotted lines,
> > masking and fountain fills by hand in Smalltalk. I'd do
> anti-aliasing
> and
> > alpha, but they require working at the individual pixel
> level, and the
> > slowness there is prohibitive.
> >
> > Cheers,
> > Steve
> >
> > -----Original Message-----
> > From: Eliot Miranda [mailto:[hidden email]]
> > Sent: 25. toukokuuta 2007 1:10
> > To: Steven Kelly
> > Cc: vwnc
> > Subject: Re: VW graphical look [Was: Re: MacOS X]
> >
> >
> > Steve,
> >
> >    basically the VM code is at completely the wrong level.  By
> > putting things down in the VM
> >
> > - the VM has to mantain a complicated and ineffective cache of
> the
> > last graphics context used so that it doesn't have to
> rebuild the OS's
> > graphics context from it on every primitive operation.  In
> any case it
> has
> > to do significant work to verify the cache is valid (compare lots of
> state
> > in the VM's cached GC ith the image-level GC) and then update the
> cached
> > GC with whatever may have changed.
> >
> > - the VM code is inaccessible, not extensible, relatively hard
> to
> > mantain, not shared between platforms, and is C.
> >
> > The only advantages the VM code has are
> > - allows the VI code to be platform-independent (and this is
> > increassingly a dubious benefit right?)
> > - allows certain operations to benefit from C speed (e.g.
> characer
> > string writing where it has to be composed out of writing individual
> > characters)
> > - its easy to enfore platform independence because the VM
> mediates
> > all graphics access
> >
> > If work is put into the FFI then the speed advantage goes away.
> > Having an image-leve implementation allows direct use of an
> OS GC with
> no
> > need for the VM cache, allows the VI to get to whatever
> extensions the
> > platform provides easily, allows the VI to implement
> platform-independent
> > fallback code in Smalltalk instead of costly buggy C.  Platform-
> > independence can be maintained using a test suite.
> >
> > Essentially moving the whole ball of wax up to the image will
> result
> > in something that can evolve much faster and be maintained
> much more
> > cheaply.  But to do this the initial hump of implementing
> the existing
> > facilities in Smalltalk for three plaforms must be traversed.
> >
> >
> > On 5/24/07, Steven Kelly <[hidden email]> wrote:
> >
> >
> >
> >
> > From: Travis Griggs [mailto:[hidden email] ]
> >
> > Upon reflection (and a nice walk-n-talk to the
> local
> > Subway), I think the synopsis of this discussion might be
> boiled down
> to
> > two viewpoints:
> >
> >
> > 1) I'm fine with the VW GC API, but want what it
> does to
> > be done better.
> > 2) The VW GC API is old fashioned, I don't care
> how it
> > does what it does, but I want an API that does more things.
> >
> >
> > There are some overlaps surely. To date, those
> of us who
> > have been playing with Cairo are probably more in the #2 camp.
> >
> > Brilliant analysis! And many thanks for keeping
> this discussion
> > calm.
> >
> > I've been talking here about camp #1. We all have a lot
> of
> > stuff existing at a high level, built on the low-level VW GC API. If
> we
> > throw that API away, we're reduced to moving all that existing stuff
> to
> > work on the new API, which is at a substantially lower level than we
> are
> > used to. Or then we have to re-build the graphics layers on top of
> Cairo,
> > so we can work at a high level again. Either way, a lot of work. I
> think
> > camp #1 is better served by a solution that keeps the old
> API but adds
> > anti-aliasing and alpha. Changing a couple of lines of C in the VM,
> and
> > linking to GDI+ rather than GDI, may be a good solution to get this
> > working on Windows. (OK, so it will be more complicated
> than that, but
> you
> > hopefully get the point.)
> >
> > I'm all in favour of the many extra Cairo features. We
> need
> > them more than many people, as we are building a graphical modeling
> tool.
> > I wrote pure Smalltalk implementations of gradient, radial,
> square and
> > path fills, with multiple color points. Optimizing that so you can
> > directly edit the angles and color points of the fills in real time
> was
> > fun, but hard enough that I'm happy if I don't have to keep doing
> things
> > like that. Being able to do Cairo drawing (with low-level
> calls) to a
> VW
> > GraphicsContext may be a good solution for this.
> >
> > Steve
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Andre Schnoor
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Boris Popov wrote:
> So what are the absolute minimum changes that would make you happy?
>
> 1. Adding AA of lines and text
> 2. Adding proper alpha support
> 3. What else?
>  
3. Speed ;-)

This could be achieved by adding an instance variable to GraphicsContext
that remembers the host GC handle across multiple drawing calls (groups
drawing actions, e.g. during #displayOn: ). A "dirty" flag set from the
image level whenever an instvar was changed can eliminate the need to
compare GCs at the VM level.

    GraphicsContext>>groupedDo: aBlock
    GraphicsContext>>markDirty
    GraphicsContext>>flush

It is likely that all platforms will benefit from such a
caching/grouping mechanism (but OSX definitely needs it most). I've done
some preliminary hacking, but as of now, my Objective-C skills are not
yet sufficient to get farther.

Andre

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Andre Schnoor
In reply to this post by Steven Kelly

Steven Kelly wrote:
> [...]
>
> Our own app uses graphics intensely, and we haven't had major speed
> problems on OS X native, so maybe there's something particular causing
> problems in Andre's case?
>  
A full-screen sheet takes almost 20 seconds to render on OS X, while
only 0.8 sec on Windows. Both are using the same code, which is
optimized and fine-tuned (clipping, dynamic details, etc). I'm sure GC
caching would help.

I'd be interested in the graphics you are doing (off list?)

Andre




Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Joerg Beekmann, DeepCove Labs (YVR)
In reply to this post by Michael Lucas-Smith-2
Michael Lucas writes: 
------------------------ 
Take the MacOSX Aqua VM for example. The quartz platform, like the WPF and Cairo platform, do graphics by specifying positions between points, not on points. This is an incredibly important detail - it's a fundamental graphics shift that happened a while back (and Microsoft only just caught up). It makes all of the graphics primitives that currently exist incompatible. Instead of drawing a line from 0@0@ to: 10@0, you actually draw a line of 1 thinkness between x: -0.5..0.5 to 9.5..10.5. That's in important distinction because if you want to fill an area, you must understand that you're not drawing /on/ pixels, you're drawing /between/ pixels.

The MacOSX VM team has done an amazing job trying to fake pixel drawing on this kind of platform. Poor guys!.. the truth is that we should have dropped found a way to drop on-pixel for between-pixel 10 years ago - but doing it cross platform back then would have been very hard, especially on the windows platform.

Today, however, we can pick up a library called Cairo. Contrary to the way you put it above - Cairo's graphics primitives are far less primitive than the primitives you get in GDI. First of all, they work between pixels, which is a huge bonus. They work across platform and finally, they describe higher level drawing constructs. For example - gradient blends, rotations, skews, so on and so forth.
--------------------
 
 
Michael, on the one hand you say a on-pixel to between pixel mapping is darn near impossible, and in the next you say the MacOSX VM team has basically done it.
 
Hum... would it not be possible to
1)  take the "amazing work the the MacOSX VM team has done" to create a on-pixel drawing layer based for Quartz and create a mapping to Cairo instead. Presumabley you could then even drop the the mapping to Quartz. Make this Cario "under the covers layer" a replacement for the current graphis library accross the board, perhaps adding some of the most pressing enhancments.  A least this way all that work is not Quartz but rather becomes a re-usable mapping to Cairo. 
2) then also expose a native Cairo interface and use that to create a next generation graphics environment.
Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Michael Lucas-Smith-2

 
Michael, on the one hand you say a on-pixel to between pixel mapping is darn near impossible, and in the next you say the MacOSX VM team has basically done it.

Sure. You can do it. They did it.. but you should hear about some of the amazing hacks they did to get it to work. For one, they're drawing with a bias for everything they do - and then Travis today was telling me how hard it is for them to do arc.. I'm very impressed by their work, but I also hear there are still bugs. Just recently someone mailed this list about another issue solved by applying another 0.5 bias to the drawing routine. I think it was even line drawing.

In my mind, almost anything might be possible - it doesn't mean you want to do it. In the case of the MacOSX VM interfacing with Quartz, they didn't have much of a choice at the time but to try and do it. Hopefully we can evolve beyond that now.

But that's just my opinion - the MacOSX VM guys might have a different opinion wrt to their work in this regard.

Cheers,
Michael

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Runar Jordahl
In reply to this post by Steven Kelly
> 2. Alpha on Images and Masks
>   - this could be done in pure Smalltalk, since it's only needed for
> things like small toolbar button images that can be cachedPNG Alpha Channel Icons

In public Store DB I have published bundle "Epigent Icon" which adds
PNG-based Alpha Channel Icons. Read comments for more information. The
icon class is 9x % compatible with the old one (UI.Icon). Although it
is meant for icons, nothing prevents you from using this code to
display PNG transparent images.

This is early work, but seems to work OK now. The (simple) API is
still changing.

It uses Smalltalk to draw, and will perform slowly if a very large
portion of the screen is to be updated. There are however ways to
increase the speed, and I will look at that the coming weeks.

Runar Jordahl

Reply | Threaded
Open this post in threaded view
|

RE: VW graphical look [Was: Re: MacOS X]

Joerg Beekmann, DeepCove Labs (YVR)
In reply to this post by Michael Lucas-Smith-2
 

 
 
Michael, on the one hand you say a on-pixel to between pixel mapping is darn near impossible, and in the next you say the MacOSX VM team has basically done it.

Sure. You can do it. They did it.. but you should hear about some of the amazing hacks they did to get it to work. For one, they're drawing with a bias for everything they do - and then Travis today was telling me how hard it is for them to do arc.. I'm very impressed by their work, but I also hear there are still bugs. Just recently someone mailed this list about another issue solved by applying another 0.5 bias to the drawing routine. I think it was even line drawing.

In my mind, almost anything might be possible - it doesn't mean you want to do it. In the case of the MacOSX VM interfacing with Quartz, they didn't have much of a choice at the time but to try and do it. Hopefully we can evolve beyond that now.

But that's just my opinion - the MacOSX VM guys might have a different opinion wrt to their work in this regard.
My point was that no matter how hard or ugly the task CinCom has made a commitment to the Quartz VM. If that's a given why not have them write to Cairo rather than direct to Quartz? It seems to me that would give the product planning team options with respect to future direction.

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Joachim Geidel
In reply to this post by Travis Griggs-3
Hi Travis,

Travis Griggs schrieb am 24.05.2007 22:43:
> Create a subclass of ScreenGraphicsContext. Add a lazy created instance
> variable for the cairo context. Send carioContext to self to get it.

Instances of ScreenGraphicsContext are created every time something has
to be drawn on the screen. If a Cairo context is created for each one of
them, and released only upon finalization, Cairo will quickly fail with
out of memory errors. At least that's what I observed with the Cairo DLL
coming with GTK+ for Windows. To avoid this problem, the Cairo context
should be cached at the Window level, or one has to find a way to
reliably release it when drawing is done. The obvious place where the
problem appears is during scrolling. See
ScrollWrapper>>update:with:from: - a new GraphicsContext is allocated
for every single movement. Quickly scrolling a Cairo based component
back and forth creates Cairo contexts faster than finalization releases
them.

Andre Schnoor recently suggested to cache the ScreenGraphicsContext to
speed up graphics output on MacOS X. I think this would be a must when
using Cairo in the way you suggest.

> In
> this way, it uses all of the original implementation, and you can
> begin to override methods on a case by case basis to do it with Cairo.

Would it be necessary to use cairo_surface_mark_dirty before and
cairo_surface_flush after ever Cairo based output on a surface when
mixing Cairo operations with non-Cairo ones? It might make the
implementation cumbersome. What would that mean for performance?

> You're never going to try and replace the text stuff. The other VW
> text objects are just too intertwined.

I agree that replacing text output in a transparent way is almost
impossible when backward compatibility has to be preserved. Maybe it
would be a bit simpler to migrate a complete image to Cairo output - in
that case, one could replace ComposedText and TextMeasurer with all of
its subclasses by something else. But this would mean that not only
ScreenGraphicsContext, but also HostPrinterGraphicsContext and
PostscriptGraphicsContext have to be Cairo based. That would be more
than just a weekend's work...

Cheers,
Joachim Geidel

Reply | Threaded
Open this post in threaded view
|

Re: VW graphical look [Was: Re: MacOS X]

Travis Griggs-3

On May 27, 2007, at 4:12, Joachim Geidel wrote:

Hi Travis,

Travis Griggs schrieb am 24.05.2007 22:43:
Create a subclass of ScreenGraphicsContext. Add a lazy created instance
variable for the cairo context. Send carioContext to self to get it. 

Instances of ScreenGraphicsContext are created every time something has
to be drawn on the screen. If a Cairo context is created for each one of
them, and released only upon finalization, Cairo will quickly fail with
out of memory errors. At least that's what I observed with the Cairo DLL
coming with GTK+ for Windows. To avoid this problem, the Cairo context
should be cached at the Window level, or one has to find a way to
reliably release it when drawing is done. The obvious place where the
problem appears is during scrolling. See
ScrollWrapper>>update:with:from: - a new GraphicsContext is allocated
for every single movement. Quickly scrolling a Cairo based component
back and forth creates Cairo contexts faster than finalization releases
them.

Andre Schnoor recently suggested to cache the ScreenGraphicsContext to
speed up graphics output on MacOS X. I think this would be a must when
using Cairo in the way you suggest.

I think I would want to profile before deciding for sure. I've had a number of discussions about context creation for Cairo with the Cairo-ites on the #irc channel and the mailing list. They all seem to advocate the pattern of creating a new context for ever "display cycle" (in windows-esque, for ever VW_PAINT). Not doing so was what lead to weird and subtle bugs for the original Akamaru demo.

That said, it might quite well be that just blindly relying on Weaklings and the VM's finalization queue to clean things up in batch mode, is probably not the best idea. I do know that there were some bugs regarding the way win32 surfaces were being cleaned up, Holger and friends improved this I believe.


In
this way, it uses all of the original implementation, and you can
begin to override methods on a case by case basis to do it with Cairo.

Would it be necessary to use cairo_surface_mark_dirty before and
cairo_surface_flush after ever Cairo based output on a surface when
mixing Cairo operations with non-Cairo ones? It might make the
implementation cumbersome. What would that mean for performance?

I honestly don't know.

You're never going to try and replace the text stuff. The other VW
text objects are just too intertwined.

I agree that replacing text output in a transparent way is almost
impossible when backward compatibility has to be preserved. Maybe it
would be a bit simpler to migrate a complete image to Cairo output - in
that case, one could replace ComposedText and TextMeasurer with all of
its subclasses by something else. But this would mean that not only
ScreenGraphicsContext, but also HostPrinterGraphicsContext and
PostscriptGraphicsContext have to be Cairo based. That would be more
than just a weekend's work...

Yes indeed. And in the end, for me, I like the Pango API's better than the classical VW ones. So I find myself not carying. It's a sort of paradigm shift for me. It's all kind of the same stuff, but there's enough differences throughout the Cairo/Pango interface, that I find the more I play with it, I don't just map VW approach to drawing over, I start thinking about it in new and fun ways. Having written my first graphical programs in ObjectWorks 4.0 beta in 1992, it's been a fun adventure for me so far.

--
Travis Griggs
Objologist
"It's [a spec] _the_ single worst way to write software, because it by definition means that the software was written to match theory, not reality" - Linus Torvalds


12