Re: DrawContext -- reports on self?

Bob Friesenhahn <[email protected]> Sun, 28 Aug 2011 22:59:23 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
On Mon, 29 Aug 2011, [email protected] wrote:

> How can I tell whether a DrawContext dc; type is allocated or not? The
> structure is described as opaque, and I see no reporting APIs that I
> can pass this to.

This type is allocated by DrawAllocateContext().  It is a 
pointer-based handle declared like:

   typedef struct _DrawContext *DrawContext;

so

   if (dc != (DrawContext) NULL)

or

   if (dc != 0)

should work fine for determining if it was allocated already.

If DrawAllocateContext() fails to allocate the context structure 
(indicating a serious problem) then the program will simply exit with 
a fatal error.  If one of the allocated members of the structure fails 
to be allocated, then (DrawContext) NULL is returned, and an error 
message is saved to image->exception.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev