| Log In | Not a Member? |
Contact ADC
|
|
Using QuickTime for Fast and Flexible DrawingDispatch 8Many applications draw graphics into an offscreen buffer and then
copy the offscreen buffer to the screen. This allows for flicker free
drawing of complex graphics. Most applications use QuickDraw's
The following code snippets assume that there is an offscreen image buffer (GWorldPtr) called "gw" and a window (WindowPtr) called "w". The easiest way to use QuickTime to copy an offscreen buffer is
with the Image Compression Manager's ImageDescriptionHandle imageDesc; SetGWorld((CGrafPtr)w, nil); MakeImageDescriptionForPixMap(gw->portPixMap, &imageDesc); DecompressImage(GetPixBaseAddr(gw->portPixMap), imageDesc, ((CGrafPtr)w)->portPixMap, nil, &w->portRect, ditherCopy, nil); DisposeHandle((Handle)imageDesc);
Rect srcRect; MatrixRecord matrix; SetGWorld((CGrafPtr)w, nil); MacSetRect(&srcRect, 0, 0, (**imageDesc).width, (**imageDesc).height); RectMatrix(&matrix, &srcRect, &w->portRect); RotateMatrix(&matrix, FixRatio(45, 1), FixRatio((**imageDesc).width, 2), FixRatio((**imageDesc).height, 2)); FDecompressImage(GetPixBaseAddr(gw->portPixMap), imageDesc, ((CGrafPtr)w)->portPixMap,nil, &matrix, ditherCopy, nil, nil, nil, codecNormalQuality, 0 (**imageDesc).dataSize, nil, nil); Because Both Rect srcRect; MatrixRecord matrix; ImageSequence imageSeq; MacSetRect(&srcRect, 0, 0, (**imageDesc).width, (**imageDesc).height); RectMatrix(&matrix, &srcRect, &w->portRect); DecompressSequenceBegin(&imageSeq, imageDesc, (CGrafPtr)w, nil, nil, &matrix, ditherCopy, nil, 0, codecNormalQuality, nil); After creating the Image Sequence, parameters of the Image
Sequence such as the graphics mode, transformation matrix, and clip
can be changed using DecompressSequenceFrameS(imageSeq, GetPixBaseAddr(gw->portPixMap), (**imageDesc).dataSize, 0, nil, nil);
CDSequenceEnd(imageSeq); See AlsoQuickTime 3 Reference - Image Compression Manager Change History4/16/98 - jph - First published |
|
Topics Previous | Next |