[comp.windows.x] Zooming Pixmaps on the Server

jansm@cuisun.unige.ch (MICHAL Jan 6260) (04/11/91)

Folks,

I'm trying to find a nice way to zoom pixmaps that have been loaded
onto the X-Server.  Any ideas on a good way to do this?  

I've heard something about using a server extension - is this the 
best way of doing this?  Have any of you in netland done this?

Thanks for any pointers or descriptions of experience.

-Jan-

---------------------------------------------------------
Jan Snydr-Michal                    jansm@cih.unige.ch
Digital Imaging Group                   -or-
University Hospital of Geneva       jsnydr@hstbme.mit.edu
Switzerland                         +41 22 226260

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (04/13/91)

> I'm trying to find a nice way to zoom pixmaps that have been loaded
> onto the X-Server.  Any ideas on a good way to do this?

If the pixmap you want to zoom has powers of two for both dimensions,
and you want to zoom it by a power of two, I have code that may be of
interest.  It uses many CopyArea and CopyPlane calls, of course, and
auxiliary storage in the form of more pixmaps.  From my March 7th
posting describing my program, the time costs (for square pixmaps) are:

>	Total cost, for magnifying a 2^N pixmap to 2^(N+2):
>	
>	XSetFunction	9 + 24N
>	XSetForeground	8 + 4N
>	XSetBackground	4N
>	XCopyArea	9 + 24N
>	XCopyPlane	16N
>	XFillRectangle	8
>	
>	This is actually a special case of an algorithm to zoom a 2^N
>	pixmap to 2^(N+M).  Cost estimates for the more general
>	algorithm:
>	
>	XSetFunction	1 + 2M^2 + 12NM
>	XSetForeground	4M + 2NM
>	XSetBackground	2NM
>	XCopyArea	1 + 2M^2 + 12NM
>	XCopyPlane	8NM
>	XFillRectangle	4M

The space costs: one bitmap (one-bit-deep pixmap) of the same size as
the pixmap being zoomed and two pixmaps of the same size and depth as
the pixmap being zoomed.

Of course, there are tradeoffs.  Depending on how cheap pixmaps are,
how fast CopyArea and CopyPlane requests are, and how feasible it is
(in terms of client memory, CPU cycles, etc) to XGetImage the pixmap,
magnify it client-side, and XPutImage it back, this may or may not be
worthwhile.  Tanstaafl, y'know....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu