simple display (from: GUI library for D)

Michel Fortin michel.fortin at michelf.com
Fri Apr 8 18:55:13 PDT 2011


On 2011-04-08 21:45:20 -0400, Adam D. Ruppe <destructionator at gmail.com> said:

> Michel Fortin wrote:
>> One issue is that different operating system will draw things with
>> slightly different algorithms, which will result in slightly different
>> images, which might introduce glitches from platform to platform.
> 
> I actually hit an even bigger problem... Xlib can't actually draw
> to XImages, and you don't have direct pixel access to XPixmaps
> (it's the difference between being on the X Server and the client).
> 
> So, the lowest common denominator, using only system libraries, is
> actually to allow *only* pixel access to Image, and move other
> drawing over to the Window. (Specifically, a Painter struct that
> ties to the window, so it can manage graphics contexts... yeah,
> it's starting to get complicated again.)
> 
> What this means is if we want to draw to images, we've
> got to spin our own algorithms. Which makes the different OS
> algorithms moot - the direct screen drawing will be different, but
> the images will all be the same. The downside is their functions
> will lag a bit since I can't just wrap some C calls.

Personally, I wouldn't even bother with direct screen drawing in that 
case. Direct screen drawing will need a different implementation for 
each OS, which means a lot of duplicated effort that could be put in 
implementing dependency-less cross-platform drawing primitives instead.

As for text, which library does the X server uses to draw text? 
Freetype? You could link directly to it when you need to draw text... 
and on other OS use similar OS services.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list