nancie@hal.CSS.GOV (Nancie Matson) (02/19/91)
Does anyone know how difficult it would be to rotate a pixmap in one degree increments interactively on the display. I have an image drawn into a pixmap, and would like to be able to select a center point, and rotate it about that point in any incremental number of degrees. I would appreciate it if anyone who has done this could point me in the right direction for code, etc. Eventually I will be trying to match two images up, and create a single one. The user should be able to rotate one image, to match up with the other one, and fuse the two together. Thanks in advance. --------------------------------------------------------------- Nancie P. Matson NET: nancie@hal.CSS.GOV ENSCO INC. MAIL: 445 Pineda Ct. Melbourne, Fl. 32940 ---------------------------------------------------------------
tim@b23b.ingr.com (Tim Anderson) (02/22/91)
In article <519@hal.CSS.GOV>, nancie@hal.CSS.GOV (Nancie Matson) writes: > >Does anyone know how difficult it would be to rotate a pixmap >in one degree increments interactively on the display. I have >an image drawn into a pixmap, and would like to be able to >select a center point, and rotate it about that point in any >incremental number of degrees. > There are no generic routines in X to do what you ask. You might want to check in the "comp.graphics" FAQ - the following isn excerpt: . 6) Rotating a raster image by an arbitrary angle. . The obvious but wrong method is to loop over the pixels in the source . image, transform each coordinate, and copy the pixel to the destination. . This is wrong because it leaves holes in the destination. Instead, . loop over the pixels in the destination image, apply the *reverse* . transformation to the coordinates, and copy that pixel from the source. . This method is quite general, and can be used for any one-to-one . 2-D mapping, not just rotation. You can add anti-aliasing by doing . sub-pixel sampling. . . However, there is a much faster method, with antialising included, . which involves doing three shear operations. The method was originally . created for the IM Raster Toolkit (see below); an implementation is . also present in PBMPLUS. Reference: "A Fast Algorithm for Raster . Rotation", by Alan Paeth (awpaeth@watcgl.waterloo.edu) Graphics . Interface '86 (Vancouver). An article on the IM toolkit appears in . the same journal. An updated version of the rotation paper appears . in "Graphics Gems" (see section [1]) under the original title. If the user is performing a dynamic input for the angle, your performance will degrade geometrically to the area of the bitmap. Just one pointer, ignore the unset bits if its a bitmap (most bitmaps are white space). > >Thanks in advance. -- ______________________________________________________________________ / / / / Tim Anderson ( uunet!ingr!b23b!tim!tim ) / Shift to the left, / / Systems Product Marketing / Shift to the right, / / Intergraph Corporation / Push 'em, Pop 'em, / / Huntsville, Alabama 35807-4201 / Byte, byte, byte !!! / / Mailstop: LR23B4 Phone: (205) 730-8503 / / /_____________________________________________/_______________________/