[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Reading images

From: Alexander Malmberg
Subject: Re: [RFC] Reading images
Date: Sun, 21 Sep 2003 16:26:03 +0200

Pete French wrote:
> > To those who want to use it, I want to warn that the results of this are
> > fairly device-dependent. Doing image manipulation this way is not a good
> > idea. Even just drawing an image to an off-screen window and reading it
> But this has always been the case with OpenStep systems hasnt it ? I
> assume it still works this way under OSX in fact.

>From the docs and the general philosophy of ps, I assume that this has
always been the case, but I can't directly confirm it.

> > * The device might not be 72 dpi (in that case, the size in pixels of
> > the returned image will not be the same as the original image).
> If you draw an image into an offscreen window without changing
> the scale then it should come out at 1;1 though.

No, and that's the important point. When you draw a 100x100 image into a
100x100 rectangle, those coordinates are in user space (in points,
unless you changed it). If the device is not exactly 72 dpi, the
coordinates in device space will be different. Eg. on a 144 dpi device
(like a high resolution screen), the image will be 200x200 in device
space, and since GSReadRect: reads raw pixels from the device, you'd get
a 200x200 image back.

> Drawing into a scaled
> offscreen window is something I've used to rescale images in the past.
> For example, the primary use I have for this is in mapping - I want
> to take a 2D map and drape it over a 3D framework. But to do texture
> mapping in OpenGL toy need an image as a power of 2. Simplest solution
> is to create an offscreen window of 1024x102, draw into it and then get
> the data back. Which gives you watever date you wanted to drape as
> a 1024 square grid.

Well, you'd have to make sure that the window is 1024x1024 device
pixels, which may not correspond to 1024x1024 in the default user space.

> i.e. its a feature rather than a problem :-)

True. :)

- Alexander Malmberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]