Arlindo da Silva a écrit:
One of the historical features of GRX is the the notion of a Graphics mode. The current windows driver behaves in a rather unintuitive manner: one cannot increase the window size beyond the size specified at startup and when you shrink it, it simply clips the display; a more intuitive behavior would be to rescale the contents of the window and repaint it.
My question for you: do you see any hope of having a Win32 (and X11 for that matter) driver that allows one to resize the window and have its contents rescaled and repainted?
I have uploaded to the GRX site in the "More things" section a patch http://grx.gnu.de/ReSize.diff which is a step towards this goal, for both the win32 and the x11 targets.
It contains two test program to show how to work with it. In this case the rescaling and repainting is made by the main program which uses grx. When you resize the window, the system only changes the maximum size and the clipping size of the Screen context and of the Current context, and enqueues a GRX event GRX_SIZE_CHANGED. The calling program waits in a loop, recognizes the event, and clears and redraws the window with the new scale. the mousetst.c test program is event driven, and uses the GRX_SIZE_CHANGED event himself. the winclip.c test program is in a GrKeyPressed loop, and recognizes the event by looking for the change of GrSizeX or GrSizeY.
You probably had in mind something more difficult: automatic repainting by GRX. I have found functions for rescaling bitmaps, but I see two problems for that
- rescaling looses information and degrades the drawing. This accumulates with several resizings.
- If you want to draw further on a rescaled window, you have to rescale all contexts in use. There is presently no book keeping of the contexts in use by GRX. You can even create a temporary context or subcontext in stack (using the last pointer "where" of GrCreateContext or GrCreateSubcontext), and never destroy it explicitly, so that the adress becomes invalid when exiting from the function where it is declared.
The only clean way to overcome both problems is to have a fixed bitmap, write the drawings on it in its original, never modified size, and put to screen a resized version. But I have no idea on how to do that: it is probably a major rewriting. So no promise ...
Maurice