Changeset 1156
- Timestamp:
- Sep 30, 2006, 8:56:23 PM (14 years ago)
- Location:
- libcaca/trunk/cxx
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cxx/Makefile.am
r977 r1156 17 17 18 18 if USE_CXX 19 noinst_PROGRAMS = c pptest19 noinst_PROGRAMS = cxxtest 20 20 endif 21 21 22 c pptest_SOURCES = cpptest.cpp23 c pptest_LDADD = libcaca++.la libcucul++.la ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@22 cxxtest_SOURCES = cxxtest.cpp 23 cxxtest_LDADD = libcaca++.la libcucul++.la ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@ 24 24 -
libcaca/trunk/cxx/cucul++.cpp
r899 r1156 24 24 #include "cucul++.h" 25 25 26 27 unsigned long int Charset::utf8ToUtf32(char const *s, unsigned int *read) 28 { 29 return cucul_utf8_to_utf32(s, read); 30 } 31 unsigned int Charset::utf32ToUtf8(char *buf, unsigned long int ch) 32 { 33 return cucul_utf32_to_utf8(buf, ch); 34 } 35 unsigned char Charset::utf32ToCp437(unsigned long int ch) 36 { 37 return cucul_utf32_to_cp437(ch); 38 } 39 unsigned long int Charset::cp437ToUtf32(unsigned char ch) 40 { 41 return cucul_cp437_to_utf32(ch); 42 } 43 44 26 45 Cucul::Cucul() 27 46 { … … 39 58 Cucul::Cucul(Buffer *b, char const *format) 40 59 { 41 cv = cucul_import_canvas(b->get _buffer(), format);60 cv = cucul_import_canvas(b->getBuffer(), format); 42 61 if(!cv) throw -1; 43 62 } … … 72 91 { 73 92 cucul_set_color(cv, f, b); 93 } 94 95 int Cucul::setTruecolor(unsigned int f, unsigned int b) 96 { 97 return cucul_set_truecolor(cv, f, b); 74 98 } 75 99 … … 212 236 } 213 237 238 unsigned long int Cucul::getColor(int x, int y) 239 { 240 return cucul_get_color(cv, x, y); 241 } 242 243 int Cucul::setBoundaries(cucul_canvas_t *, int x, int y, 244 unsigned int w, unsigned int h) 245 { 246 return cucul_set_canvas_boundaries(cv, x, y, h, w); 247 } 248 249 unsigned int Cucul::getFrameCount() 250 { 251 return cucul_get_canvas_frame_count(cv); 252 } 253 int Cucul::setFrame(unsigned int f) 254 { 255 return cucul_set_canvas_frame(cv, f); 256 } 257 int Cucul::createFrame(unsigned int f) 258 { 259 return cucul_create_canvas_frame(cv, f); 260 } 261 int Cucul::freeFrame(unsigned int f) 262 { 263 return cucul_create_canvas_frame(cv, f); 264 } 265 214 266 Dither::Dither(unsigned int v1, unsigned int v2, unsigned int v3, unsigned int v4, unsigned int v5, unsigned int v6, unsigned int v7, unsigned int v8) 215 267 { … … 317 369 } 318 370 371 unsigned long int const *Font::getBlocks() 372 { 373 return cucul_get_font_blocks(font); 374 } 375 319 376 Font::~Font() 320 377 { … … 322 379 } 323 380 324 Buffer::Buffer(Cucul *cv, char const *buf) 325 { 326 buffer = cucul_export_canvas(cv->get_cucul_canvas_t(), buf); 327 if(!buffer) throw -1; 381 Buffer::Buffer() 382 { 383 buffer_ = NULL; 384 } 385 386 Buffer::~Buffer() 387 { 388 if(buffer_) 389 cucul_free_buffer(buffer_); 328 390 } 329 391 … … 333 395 } 334 396 335 cucul_buffer *Buffer::get_buffer(void) 336 { 337 return buffer; 338 } 397 void *Buffer::getData(void) 398 { 399 return cucul_get_buffer_data(buffer_); 400 } 401 402 void Buffer::loadMemory(void *buf, unsigned long int size) 403 { 404 buffer_ = cucul_load_memory(buf, size); 405 if(buffer_ == NULL) 406 throw -1; 407 } 408 409 void Buffer::loadFile(char const *filename) 410 { 411 buffer_ = cucul_load_file(filename); 412 if(buffer_ == NULL) 413 throw -1; 414 } 415 416 unsigned long int Buffer::getSize() 417 { 418 return cucul_get_buffer_size(buffer_); 419 } 420 421 cucul_buffer *Buffer::getBuffer() 422 { 423 return buffer_; 424 } -
libcaca/trunk/cxx/cucul++.h
r917 r1156 29 29 class Cucul; 30 30 31 32 class Charset 33 { 34 unsigned long int utf8ToUtf32(char const *, unsigned int *); 35 unsigned int utf32ToUtf8(char *, unsigned long int); 36 unsigned char utf32ToCp437(unsigned long int); 37 unsigned long int cp437ToUtf32(unsigned char); 38 }; 39 40 41 42 43 31 44 /* Ugly, I know */ 32 45 class Font … … 39 52 unsigned int getHeight(); 40 53 void renderCanvas(Cucul *, unsigned char *, unsigned int, unsigned int, unsigned int); 41 54 unsigned long int const *getBlocks(); 55 42 56 private: 43 57 cucul_font *font; 44 58 45 59 }; 46 60 … … 75 89 friend class Cucul; 76 90 public: 77 Buffer( Cucul *cv, char const *);91 Buffer(); 78 92 ~Buffer(); 79 93 char const *const * getExportList(void); 94 void *Buffer::getData(void); 95 void loadMemory(void *buf, unsigned long int size); 96 void loadFile(char const *filename); 97 unsigned long int getSize(); 80 98 81 99 protected: … … 83 101 84 102 private: 85 cucul_buffer *buffer; 103 cucul_buffer *buffer_; 104 cucul_buffer *getBuffer(); 86 105 }; 87 106 … … 103 122 unsigned int getHeight(void); 104 123 void setColor(unsigned int f, unsigned int b); 124 int setTruecolor(unsigned int f, unsigned int b); 125 unsigned long int getColor(int, int); 105 126 char const * getColorName(unsigned int color); 106 127 void Printf(int x , int y , char const * format,...); 107 128 void putChar(int x, int y, char ch); 129 unsigned long int getChar(cucul_canvas_t *, int, int); 108 130 void putStr(int x, int y, char *str); 109 131 void Clear(void); … … 128 150 void fillTriangle(int, int, int, int, int, int, char const *); 129 151 int Rand(int, int); 152 int setBoundaries(cucul_canvas_t *, int, int, 153 unsigned int, unsigned int); 154 unsigned int getFrameCount(); 155 int setFrame(unsigned int); 156 int createFrame(unsigned int); 157 int freeFrame(unsigned int); 130 158 131 159 protected:
Note: See TracChangeset
for help on using the changeset viewer.