Coconut Data Framework  beta
CNPixmap.h
Go to the documentation of this file.
00001 
00008 #import <CoconutXML/CoconutXML.h>
00009 #import <libxml/tree.h>
00010 #import <assert.h>
00011 
00013 typedef const struct CNColor *      CNPixel ;
00014 
00018 struct CNPixmap {
00020         struct CNObject                         superClass ;
00022     struct CNString *                   name ;
00024         unsigned int                            width ;
00026         unsigned int                            height ;
00028     CNPixel *                                   pixels ;
00029 } ;
00030 
00034 struct CNPixmapMethods {
00036         struct CNObjectMethods                                  superClass ;
00037 } ;
00038 
00049 struct CNPixmap *
00050 CNAllocatePixmap(struct CNString * name, unsigned int width, unsigned int height, struct CNResource * resource) ;
00051 
00056 static inline void
00057 CNReleasePixmap(struct CNPixmap * dst)
00058 {
00059         CNReleaseObject(&(dst->superClass)) ;
00060 }
00061 
00067 struct CNPixmap *
00068 CNClonePixmap(struct CNPixmap * src) ;
00069 
00075 static inline struct CNString *
00076 CNNameOfPixmap(const struct CNPixmap * src)
00077 {
00078     return src->name ;
00079 }
00080 
00088 static inline void
00089 CNSetNameToPixmap(struct CNPixmap * dst, struct CNString * newname)
00090 {
00091         if(newname){
00092                 CNRetainString(newname) ;
00093         }
00094         if(dst->name){
00095                 CNReleaseString(dst->name) ;
00096         }
00097         dst->name = newname ;
00098 }
00099 
00105 void
00106 CNFillPixmap(struct CNPixmap * dst, CNPixel src) ;
00107 
00115 void
00116 CNCopyPixmap(struct CNPixmap * dst, const struct CNPixmap * src) ;
00117 
00123 static inline const CNPixel *
00124 CNPixelsInPixmap(const struct CNPixmap * src)
00125 {
00126         return src->pixels ;
00127 }
00128 
00136 static inline CNPixel
00137 CNPixelInPixmap(const struct CNPixmap * src, unsigned int x, unsigned int y)
00138 {
00139         unsigned int off = y * (src->width) + x ;
00140     return ((src->pixels)[off]) ;
00141 }
00142 
00150 static inline void
00151 CNSetPixelToPixmap(struct CNPixmap * dst, unsigned int x, unsigned int y, const struct CNColor * src)
00152 {
00153         unsigned int off = y * (dst->width) + x ;
00154     (dst->pixels)[off] = src ;
00155 }
00156 
00162 static inline unsigned int
00163 CNWidthOfPixmap(const struct CNPixmap * src)
00164 {
00165         return src->width ;
00166 }
00167 
00173 static inline unsigned int
00174 CNHeightOfPixmap(const struct CNPixmap * src)
00175 {
00176         return src->height ;
00177 }
00178 
00184 static inline const struct CNColor **
00185 CNVectorOfPixmap(const struct CNPixmap * src)
00186 {
00187         return src->pixels ;
00188 }
00189 
00198 NSInteger
00199 CNComparePixmap(const struct CNPixmap * s0, const struct CNPixmap * s1) ;
00200 
00205 const xmlChar *
00206 CNElementNameOfPixmap(void) ;
00207 
00213 xmlNodePtr
00214 CNEncodePixmap(const struct CNPixmap * src) ;
00215 
00226 struct CNPixmap *
00227 CNDecodePixmap(xmlNodePtr src, struct CNResource * resource, struct CNXMLDecodeError * error) ;
00228 
00229 
00230