Wimp question

David J. Ruck druck at freeuk.com
Wed Aug 1 20:31:56 BST 2001


On 1 Aug 2001 Stefan Bellon <sbellon at sbellon.de> wrote:
>>> Currently I'm displaying a JPEG in a simple window which works very well.
>>> But on a mode change that modifies the xeig and/or yeig values, the
>>> window is double or half the size in any or both directions.
> 
> Ok, perhaps I was not specific enough. In a mode change from xeig == 1 to
> xeig == 2 for example, everything works fine, i.e. the window appears
> exactly the same size. But on a mode change from xeig == 1 to xeig == 0 or
> from xeig == 2 to xeig == 1, the window's xsize is double the size, thus
> leaving half of the window undefined. The image is in the left half and in
> the right half, there's garbage (if you move the window around).

I think your problem is that the wimp will always try to preserve the OS unit
size of the windows regardless of the eigen (pixels per OS unit) factors, but
the JPEG calls work on a given pixel scalling ratio.

e.g.

In X1600 Y1200 EX1 EY1 there are 2 (2<<1) OS units per pixel and the screen
size is 3200x2400 OS units. Your window is 800 by 800 OS units corresponding
to 400 by 400 pixels, in which you display a 400x400 pixel JPEG that covers
the entire area.

In 1600x1200 EX0 EY0 their is a 1:1 mapping of OS units to pixel (2<<0), so
your window is still 800x800 OS units and takes up twice the area as before.
However the JPEG routines still plot a 400x400 pixel image, so you will find
it only covers the top left quater of the window.

The solution is to read the eigen factors for the mode using OS_ReadModeVar
and modify the scale factors in the JPEG_PlotScaled or JPEG_PlotTransformed
calls. If you allow the user to change the scaling, still offer them a 1:1
option that gives the same size relative to OS units, but adjust them before
passing to the call.

Cheers
---Dave

-- 
____________________________________________________________________________

  David J. Ruck    Phone: +44- (0)7974 108301    Email: druck at freeuk.com
____________________________________________________________________________



More information about the oslib-user mailing list