Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 5ea9a249e974f38e9d955cc501d3e529 > files > 16

Hermes-devel-1.3.3-18.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>Hermes 1.3 API: Surface Clearing</TITLE>
 <LINK HREF="api-3.htm" REL=previous>
 <LINK HREF="api.htm#toc4" REL=contents>
</HEAD>
<BODY>
Next
<A HREF="api-3.htm">Previous</A>
<A HREF="api.htm#toc4">Contents</A>
<HR>
<H2><A NAME="s4">4. Surface Clearing</A></H2>

<P>HERMES provides support for clearing surfaces (i.e. blocks of memory filled
with pixels) quickly and cleanly. Clearing routines exist in C, x86
assembler and MMX assembler versions and thus are fast. However, keep in 
mind that if you have the chance of using a hardware accelerated routine
for this, it will still be faster.
<P>
<P>
<H2><A NAME="ss4.1">4.1 HermesHandle Hermes_ClearerInstance()</A>
</H2>

<P>Not much to say about this, same as the other *Instance() functions. You
have to call this to obtain a handle before you use any other clearing
routines.
<P>
<P>This routine can return zero upon failure.
<P>
<P>
<H2><A NAME="ss4.2">4.2 void Hermes_ClearerReturn(HermesHandle handle)</A>
</H2>

<P>Again, if you are finished clearing surfaces (and that means completely
finished, call it only at the end of a program, not every time you have just
cleared a surface) use this function to free up any memory inside Hermes.
<P>
<P>
<P>
<H2><A NAME="ss4.3">4.3 int Hermes_ClearerRequest(HermesHandle handle,HermesFormat *format)</A>
</H2>

<P>This function will tell HERMES to prepare a special clearer for a subsequent
clear operation. Again, you may call this as often as you want, once it has
been set up, subsequent calls will be cached.
<P>
<P>Zero will be returned if your handle is invalid or the format you requested
cannot be cleared (all formats are implemented, thus you will have to
request a pretty fucked up format in order to fail this :). Upon success,
any non-zero value may be returned.
<P>
<P>
<H2><A NAME="ss4.4">4.4 int Hermes_ClearerClear(...)</A>
</H2>

<P>ClearerClear is the function that actually does the work. The request
function has to be called before this, otherwise it will fail. The following
variables have to be passed to the function:
<P>
<UL>
<LI>HermesHandle handle - the handle you have obtained by calling
Hermes_ClearerInstance().</LI>
<LI>void *pixels - the buffer to clear. It is void because it might be any
format that has been requested in Hermes_ClearerRequest()</LI>
<LI>int x1 - Upper left corner x coordinate IN PIXELS not bytes</LI>
<LI>int y1 - Upper left corner y coordinate in pixels</LI>
<LI>int width - Width of area to be cleared in pixels</LI>
<LI>int height - Height of area to be cleared in pixels</LI>
<LI>int pitch - Amount IN BYTES to add in order to get from the beginning
of a scanline to the beginning of the next. See the conversion section for
more on this.</LI>
<LI>int32 r - For direct colour, the red component, between 0-255 !!</LI>
<LI>int32 g - For direct colour, green between 0-255</LI>
<LI>int32 b - For direct colour, blue between 0-255</LI>
<LI>char8 index - For indexed modes, the colour index to use for clearing.
For direct colour modes, the alpha value!</LI>
</UL>
<P>
<P>Hermes_ClearerClear returns any non-zero value on success. If zero is
returned, the clearing has failed, most of the time because the handle you
have passed was invalid.
<P>
<HR>
Next
<A HREF="api-3.htm">Previous</A>
<A HREF="api.htm#toc4">Contents</A>
</BODY>
</HTML>