Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-09-22 07:11:39


"John Torjo" <john.lists_at_[hidden]> wrote in message
news:415123B3.8060905_at_torjo.com...
> Andy Little wrote:
>> useful mechanism to make dumb drawing objects intelligent. For example,
>> if I had a dumb line, it should be possible to 'attach' a class that can
>> detect if that line is being grabbed with the mouse and so on.
>
> If I'm not mistaken, in this case, you would need the class to use the
> same metrics as the line.

Hmm... I shouldnt have brought this up. Its way... way beyond what I am
currently trying to achieve.:-)

However I agree that you need a metric which converts between raw device
units and the units of the 'canvas' (Thanks to Matt Trentini for the name).
That is IMO entirely logical if you wish to achieve device independence.

> As you later say - you seem to only want millimeters.

Not exactly. I prefer to use distances in some 'length' unit of measure,
which paved the way for my physical-quantities library. It could be
millimeters or miles or whatever., though of course millimeters is easy on
Windows... at the device layer.

> I don't think
> having only one set of metrics is a good thing. At least for me there
> are a lot of times when I need pixels.

Yes..As I have touched in in a previous post this should be accessible at
the 'device layer'. OTOH Another way to look at a pixel is as a rectangular
box that is *currently*, *on this device*, (say) 0.25 mm wide and 0.25 mm
high or whatever, the next layer up.

Obviously you ultimately need pixels on a particular device, but what do you
do when you want to render the drawing that you have drawn (or your Window)
on a 640x480 pixel diplay on a 1200 dpi laser-printer?. Usually you have to
interrogate the system to find out its current pixel 'metric', and convert
all your pixels on the display into some number of pixels on the printer. I
am just abstracting this process. The problem with pixels is that they can
unless you work extremely hard, lock you firmly into one device. So
*whenever possible* I would prefer not to deal with them directly.

Of course graphics programming has since time immemmorial used pixels, so it
may appear that I am 'pulling away the floor from under you'. I would liken
it to assembler programmers who see their freedom being taken away when
forced to use 'types'. Its a different way of looking at things which might
be useful sometimes, so takes time to get used to.

I am looking at your own win32gui as well as David Turners C++ gui lib.
Hopefully I may be able to apply the 'canvas' concept to either one or both,
it is after all designed to be generic:-). Useful thing about gui's is that
they can sometimes explain things much better than words:-)

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk