DIRECTORY Imager USING [Context], ImagerSample USING [RasterSampleMap], SF USING [Box, maxBox, Vec]; XlBitmap: CEDAR DEFINITIONS ~ BEGIN Bitmap: TYPE = REF BitmapRep; BitmapRep: TYPE; NarrowBitmap: PROC [x: REF ANY] RETURNS [Bitmap]; IsBitmap: PROC [x: REF ANY] RETURNS [BOOL]; CreateFromSM: PROC [sm: ImagerSample.RasterSampleMap] RETURNS [Bitmap]; Create: PROC [size: SF.Vec, bpp: NAT ¬ 1, sharedMemory: BOOL ¬ TRUE] RETURNS [Bitmap]; SetColormap: PROC [bitmap: Bitmap, colormap: REF]; GetSM: PROC [Bitmap] RETURNS [ImagerSample.RasterSampleMap]; GetBox: PROC [Bitmap] RETURNS [SF.Box]; CreateContext: PROC [bitmap: Bitmap, surfaceUnitsPerPixel: NAT ¬ 1] RETURNS [context: Imager.Context]; Refresh: PROC [bitmap: Bitmap, box: SF.Box ¬ SF.maxBox, delayOk: BOOL _ FALSE]; BoxDataProc: TYPE = PROC [box: SF.Box, data: REF, delayOk: BOOL]; RegisterInterceptionProcs: PROC [bitmap: Bitmap, refresh, preRefresh: BoxDataProc, data: REF]; RemoveInterceptionProcs: PROC [bitmap: Bitmap, data: REF]; PromiseRepaintLater: PROC [bitmap: Bitmap, box: SF.Box]; EndPromiseRepaint: PROC [bitmap: Bitmap, box: SF.Box ¬ SF.maxBox, refresh: BOOL ¬ TRUE, delayOk: BOOL _ FALSE]; END. ϊXlBitmap.mesa Copyright Σ 1990, 1991, 1992 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, October 30, 1990 2:20:01 pm PST Christian Jacobi, December 16, 1992 10:57 am PST Package which supports creation of sample-maps which can be used for XlBitmapWindows and similar packages. Creation and access A bitmap is basically a sample-map; however an extra type is used because some more data is stored with it. The geometry of a bitmap is immutable, however the "painted contents" may change arbitrary and asynchronously. Creates a bitmap repesenting a sample map. Restriction1: ImagerSample.GetBox[sm].min=[0, 0] Restriction2: If bitsPerPixel=1 then: Each scanline must start at a byte aligned location If bitsPerPixel=8 then: Each scanline must start at a 32 bit word aligned location (Must meet alignment conditions of X host AND X server) Creates a Bitmap by allocating memory sharedMemory is a hint only. It will be respected if shared memory is supported and enough free shared memory is available. The underlying samplemap may be slightly larger to fit machine dependent alignment conditions. Sets associated color map. There is only one colormap per bitmap at any time, as it is used globally. Used for newly created Context's only. Returns the sample-map underneath a bitmap. Returns designated area of bitmap (might differ from area of sample-map due to alignment conditions). Imaging Creates a context drawing into the bitmap. Drawing into this context will automatically cause refreshs to happen. The context stays alive independent whether some package actually renders the bitmap or not. Eventually "refreshes" box. More truthfully: calls interceptors which may cause refresh... delayOk is a performance hint; if TRUE the implementation might delay the processing Interception When called as a registered interception proc, the box is clipped. Installs an interceptor. If same data is used, replaces previously registrated procedure. Interceptors are called in unknown order. refresh: called on either painting into Imager.Context or calls of Refresh. preRefresh: called on few (AccessBuffer) imager operations. Be careful as interception will always be used unless removed explicitely. Removes interceptor's registered using same data. Performance tuning Do not confuse the two performance improvement mechanisms of XlBitmap. PromiseRepaintLater is a high level mechanism which may completely stop forwarding of Refresh requests to the implementing device. The delayOk parameter on Refresh is a low level means to which enables certain devices to achieve better scheduling. May cause delaying all the refreshing inside box for efficiency reasons. The caller must promise to call EndPromiseRepaint later. EndPromiseRepaint should either use same box, or, SF.maxBox. Stops further delays of refreshing inside box. refresh: calls Refresh if a delay was in effect, was removed, and, no other non removed delay allows further postponing. delayOk: passed to Refresh, if it is called. ΚΣ–(cedarcode) style•NewlineDelimiter ˜™ Icodešœ Οeœ=™HK™