Coconut Data Framework  beta
Classes | Typedefs | Functions
CNPixmap.h File Reference

Define CNPixmap class. More...

#import <CoconutXML/CoconutXML.h>
#import <libxml/tree.h>
#import <assert.h>

Go to the source code of this file.

Classes

struct  CNPixmap
 Data structure for pixmap. More...
struct  CNPixmapMethods
 Table of methods for CNPixmap instance. More...

Typedefs

typedef struct CNColor * CNPixel
 Type for pixel.

Functions

struct CNPixmap * CNAllocatePixmap (struct CNString *name, unsigned int width, unsigned int height, struct CNResource *resource)
 Initialize the content of pixmap.
static void CNReleasePixmap (struct CNPixmap *dst)
 Release CNPixmap object.
struct CNPixmap * CNClonePixmap (struct CNPixmap *src)
 Allocate the clone of pixmap.
static struct CNString * CNNameOfPixmap (const struct CNPixmap *src)
 Get name of pixmap.
static void CNSetNameToPixmap (struct CNPixmap *dst, struct CNString *newname)
 Set name of pixmap.
void CNFillPixmap (struct CNPixmap *dst, CNPixel src)
 Fill the pixmap by a pixel.
void CNCopyPixmap (struct CNPixmap *dst, const struct CNPixmap *src)
 Copy pixmap context from src to dst.
static const CNPixel * CNPixelsInPixmap (const struct CNPixmap *src)
 Get array of pixels in pixmap.
static CNPixel CNPixelInPixmap (const struct CNPixmap *src, unsigned int x, unsigned int y)
 Get pixel in pixmap.
static void CNSetPixelToPixmap (struct CNPixmap *dst, unsigned int x, unsigned int y, const struct CNColor *src)
 Set pixel to pixmap.
static unsigned int CNWidthOfPixmap (const struct CNPixmap *src)
 Get width of the CNPixmap instance.
static unsigned int CNHeightOfPixmap (const struct CNPixmap *src)
 Get height of the CNPixmap instance.
static struct CNColor ** CNVectorOfPixmap (const struct CNPixmap *src)
 Get array of pixels of the CNPixmap instance.
NSInteger CNComparePixmap (const struct CNPixmap *s0, const struct CNPixmap *s1)
 Compare pixmaps.
const xmlChar * CNElementNameOfPixmap (void)
 Get the element name for CNPixmap.
xmlNodePtr CNEncodePixmap (const struct CNPixmap *src)
 Encode CNPixmap into XML.
struct CNPixmap * CNDecodePixmap (xmlNodePtr src, struct CNResource *resource, struct CNXMLDecodeError *error)
 Decode XML node and generate CNPixmap object.

Detailed Description

Define CNPixmap class.

Copyright
Copyright (C) 2010 Steel Wheels Project

Function Documentation

struct CNPixmap* CNAllocatePixmap ( struct CNString *  name,
unsigned int  width,
unsigned int  height,
struct CNResource *  resource 
) [read]

Initialize the content of pixmap.

Returns:
Destination pixmap
Parameters:
nameName of pixmap (You can pass NULL)
widthWidth of this pixmap
heightHeight of this pixmap
resourceResource to allocate pixmap
Warning
The content pixmap array is NOT cleared/filled.
static void CNReleasePixmap ( struct CNPixmap *  dst) [inline, static]

Release CNPixmap object.

Parameters:
dstDestination object

References CNPixmap::superClass.

struct CNPixmap* CNClonePixmap ( struct CNPixmap *  src) [read]

Allocate the clone of pixmap.

Returns:
Cloned pixmap
Parameters:
srcSource pixmap
static struct CNString* CNNameOfPixmap ( const struct CNPixmap *  src) [static, read]

Get name of pixmap.

Returns:
Name of pixmap (This value will be NULL)
Parameters:
srcSource pixmap

References CNPixmap::name.

static void CNSetNameToPixmap ( struct CNPixmap *  dst,
struct CNString *  newname 
) [inline, static]

Set name of pixmap.

Parameters:
dstDestination pixmap
newnamePixmap name
Note
If you pass NULL as new name, this pixmap will have no name.

References CNPixmap::name.

void CNFillPixmap ( struct CNPixmap *  dst,
CNPixel  src 
)

Fill the pixmap by a pixel.

Parameters:
dstDestination pixmap
srcSource color to fill the pixel
void CNCopyPixmap ( struct CNPixmap *  dst,
const struct CNPixmap *  src 
)

Copy pixmap context from src to dst.

Parameters:
dstDestination pixmap
srcSource pixmap
Note
The destination pixmap will be resized before copy
static const CNPixel* CNPixelsInPixmap ( const struct CNPixmap *  src) [inline, static]

Get array of pixels in pixmap.

Returns:
Array of pixmaps
Parameters:
srcSource pixmap

References CNPixmap::pixels.

static CNPixel CNPixelInPixmap ( const struct CNPixmap *  src,
unsigned int  x,
unsigned int  y 
) [inline, static]

Get pixel in pixmap.

Returns:
Pixel value for given position
Parameters:
srcSource pixmap
xX position in the source pixmap
yY position in the source pixmap

References CNPixmap::pixels, and CNPixmap::width.

static void CNSetPixelToPixmap ( struct CNPixmap *  dst,
unsigned int  x,
unsigned int  y,
const struct CNColor *  src 
) [inline, static]

Set pixel to pixmap.

Parameters:
dstDestination pixmap
xX position of the pixel to be set
yY position of the pixel to be set
srcSource pixel to set

References CNPixmap::pixels, and CNPixmap::width.

static unsigned int CNWidthOfPixmap ( const struct CNPixmap *  src) [inline, static]

Get width of the CNPixmap instance.

Returns:
Width of the pixmap
Parameters:
srcSource pixmap

References CNPixmap::width.

static unsigned int CNHeightOfPixmap ( const struct CNPixmap *  src) [inline, static]

Get height of the CNPixmap instance.

Returns:
Height of the pixmap
Parameters:
srcSource pixmap

References CNPixmap::height.

static struct CNColor** CNVectorOfPixmap ( const struct CNPixmap *  src) [static, read]

Get array of pixels of the CNPixmap instance.

Returns:
Array of pixels
Parameters:
srcSource pixmap

References CNPixmap::pixels.

NSInteger CNComparePixmap ( const struct CNPixmap *  s0,
const struct CNPixmap *  s1 
)

Compare pixmaps.

Return values:
negatives0 is smaller than s1
0s0 and s1 are same
positives0 is bigger than s0
Parameters:
s0Source pixmap 0
s1Source pixmap 1
const xmlChar* CNElementNameOfPixmap ( void  )

Get the element name for CNPixmap.

Returns:
XML element name
xmlNodePtr CNEncodePixmap ( const struct CNPixmap *  src)

Encode CNPixmap into XML.

Returns:
Encoded node
Parameters:
srcSource pixmap
struct CNPixmap* CNDecodePixmap ( xmlNodePtr  src,
struct CNResource *  resource,
struct CNXMLDecodeError *  error 
) [read]

Decode XML node and generate CNPixmap object.

Return values:
pixmapAllocated pixmap
NULLAllocation failed
Parameters:
srcSource XML node +
resourceResource to allocate the new object
errorError information
Note
The context of "error" is set when the returned value is NULL.