Sack Library Documentation
sack::render Variable
BASE_IMAGE_NAMESPACE namespace render;

Render provides a method to display images on a screen. It is the interface between memory images and the window desktop or frame buffer the user is viewing on a monitor. 


Under windows, this is implemented as an HWND and an HBITMAP used to allow the application to draw. Updates are done directly from the drawable surface to the HWND as appropriate for the type of service. This is implemented with Vidlib.dll. 


Under Linux, this is mounted against SDL. SDL, however, does not give multiple display surfaces, so a more direct method should be used someday, other than SDL does a good job of aliasing frame buffer and X display windows to a consistant interface. This is implemented wit DisplayLib (as yet outside of the documentation). Display lib can interface either directly, or be mounted as a service across from a shared memory message service, and host multiple applications on a single frame buffer surface.

Implement displays as direct X displays, and allow managment there under linux. 

Displaylib was a good project, and although suffers from code-rot, it is probably still mostly usable. Message services were easily transported across a network, but then location services started failing.

// get a render display, just a default window of some size
// extended features are available for more precision.
Render render = OpenDisplay(0);


A few methods of using this surface are available. One, you may register for events, and be called as required.

RedrawCallback MyDraw = DrawHandler;
MouseCallback MyMouse;
KeyProc MyKey;
CloseCallback MyClose;
// called when the surface is initially shown, or when its surface changes.
// otherwise, the image drawn by the application is static, and does
// not get an update event.
SetRedrawHandler( render, MyDraw, 0 );
// This will get an event every time a mouse event happens.
// If no Key handler is specified, key strokes will also be mouse events.
SetMouseHandler( render, MyMouse, 0 );
// If the window was closed, get an event.
SetCloseHandler( render, MyClose, 0 );
// specify a handler to get keyboard events...
SetKeyboardHandler( render, MyKey, 0 );


Or, if you don't really care about any events...

// load an image
Image image = LoadImageFile( "sample.jpg" );
// get the image target of render
Image display = GetDisplayImage( render );
// copy the loaded image to the display image
BlotImage( display, image );
// and update the display
UpdateDisplay( render );


void CPROC DrawHandler( PTRSZVAL psvUserData, PRENDERER render )
    Image display = GetDisplayImage( render );
    // the display image may change, because of an external resize
    // update the image to display as desired...
    // when done, the draw handler should call UpdateDisplay or...
    UpdateDisplayPortion( render, 0, 0, 100, 100 );


Oh! And most importantly! Have to call this to put the window on the screen.

UpdateDisplay( render );


Or maybe can pretend it was hidden

RestoreDisplay( render );
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!