Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: Zooming Pixmaps on the Server Message-ID: <9104130300.AA08960@lightning.McRCIM.McGill.EDU> Date: 13 Apr 91 03:00:24 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 43 > 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