pngfuncs.cpp File Reference

(r1785/r1282)

#include "camtypes.h"
#include "png.h"
#include "pngprgrs.h"
#include "pngutil.h"

Go to the source code of this file.

Functions

void camelot_png_error (png_structp png_ptr, png_const_charp message)
 Pointer to this function given to libpng to be called in case of error.
void camelot_png_warning (png_structp png_ptr, png_const_charp message)
 Pointer to this function given to libpng to be called in case of warning.
void camelot_png_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
 Pointer to this function given to libpng to be called for reading data.
void camelot_png_write_data (png_structp png_ptr, png_bytep data, png_size_t length)
 Pointer to this function given to libpng to be called for writting data.
void camelot_png_flush_data (png_structp png_ptr)
 Pointer to this function given to libpng to be called for flushing output stream on write.
void * camelot_png_malloc (png_structp png_ptr, png_size_t size)
 Pointer to this function given to libpng to be called for allocing memory.
void camelot_png_free (png_structp png_ptr, png_voidp data)
 Pointer to this function given to libpng to be called for freeing data.
void camelot_png_write_row_callback (png_structp png_ptr, png_uint_32 row_number, INT32 pass)
 Pointer to this function given to libpng to be called when a row has been read.


Function Documentation

void camelot_png_error png_structp  png_ptr,
png_const_charp  message
 

Pointer to this function given to libpng to be called in case of error.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,error message [INPUTS]
Error message [OUTPUTS]
Returns:
void

Definition at line 121 of file pngfuncs.cpp.

00122 {
00123     TRACEUSER( "Gavin", _T("PNG: libpng error: %s\n"), message);
00124     
00125     // Use the error handler in the PNG util function which assumes TRY CATCH block in
00126     // operation and CCFile present, in which case it will use the CCFile GotError function
00127     //  PNGUtil::DefaultErrorHandler(MessageID, message);
00128     PNGUtil::DefaultErrorHandler();
00129 }

void camelot_png_flush_data png_structp  png_ptr  ) 
 

Pointer to this function given to libpng to be called for flushing output stream on write.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr [INPUTS]
Output stream flushed [OUTPUTS]
Returns:
void

Definition at line 226 of file pngfuncs.cpp.

00227 {
00228     iostream *fp = (iostream *)png_get_io_ptr(png_ptr);
00229 
00230     if (fp)
00231         fp->flush();
00232 }

void camelot_png_free png_structp  png_ptr,
png_voidp  data
 

Pointer to this function given to libpng to be called for freeing data.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,&data [INPUTS]
Returns:
void

Definition at line 264 of file pngfuncs.cpp.

00265 {
00266     CCFree(data);
00267 }

void* camelot_png_malloc png_structp  png_ptr,
png_size_t  size
 

Pointer to this function given to libpng to be called for allocing memory.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,size of memory [INPUTS]
Memory block [OUTPUTS]
Returns:
void * to memory

Definition at line 247 of file pngfuncs.cpp.

00248 {
00249     return (CCMalloc(size));
00250 }

void camelot_png_read_data png_structp  png_ptr,
png_bytep  data,
png_size_t  length
 

Pointer to this function given to libpng to be called for reading data.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,amount to be read [INPUTS]
'data' set to data from file [OUTPUTS]
Returns:
void

Definition at line 167 of file pngfuncs.cpp.

00168 {
00169     iostream *fp = (iostream *)png_get_io_ptr(png_ptr);
00170     png_uint_32 check = png_uint_32(length);
00171     
00172     if (fp)
00173         fp->read((char *) data, check );
00174     else
00175         png_error(png_ptr, "Read Error");
00176     
00177     if (check != length)
00178     {
00179         png_error(png_ptr, "Read Error");
00180     }
00181 }

void camelot_png_warning png_structp  png_ptr,
png_const_charp  message
 

Pointer to this function given to libpng to be called in case of warning.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,warning message [INPUTS]
Nothing (except a trace message) [OUTPUTS]
Returns:
void

Definition at line 145 of file pngfuncs.cpp.

00146 {
00147     if (!png_ptr)
00148         return;
00149     
00150     TRACEUSER( "Gavin", _T("PNG: libpng warning: %s\n"), message);
00151 }

void camelot_png_write_data png_structp  png_ptr,
png_bytep  data,
png_size_t  length
 

Pointer to this function given to libpng to be called for writting data.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,amount to be written, data [INPUTS]
Data in file [OUTPUTS]
Returns:
void

Definition at line 197 of file pngfuncs.cpp.

00198 {
00199     iostream *fp = (iostream *)png_get_io_ptr(png_ptr);
00200     png_uint_32 check = png_uint_32(length);
00201 
00202     if (fp)
00203         fp->write((const char*)data, check);
00204     else
00205         png_error(png_ptr, "Write Error");
00206 
00207     if (check != length)
00208     {
00209         png_error(png_ptr, "Write Error");
00210     }
00211 }

void camelot_png_write_row_callback png_structp  png_ptr,
png_uint_32  row_number,
INT32  pass
 

Pointer to this function given to libpng to be called when a row has been read.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/2000
Parameters:
png_ptr,row,pass [INPUTS]
Status bar update [OUTPUTS]
Returns:
void
IMPORTANT NOTE: This function is not used, I have just included it for completness (the write code does its own status bar updates).

Definition at line 288 of file pngfuncs.cpp.

00289 {
00290 }


Generated on Sat Nov 10 03:49:19 2007 for Camelot by  doxygen 1.4.4