@ -90,15 +90,14 @@ using namespace std;
# define PNG_BYTES_TO_CHECK (4)
# define PNGWRITER_DEFAULT_COMPRESSION (6)
class pngwriter
{
private :
class pngwriter {
private :
char * filename_ ;
char * textauthor_ ;
char * textdescription_ ;
char * texttitle_ ;
char * textsoftware_ ;
char * filename_ ;
char * textauthor_ ;
char * textdescription_ ;
char * texttitle_ ;
char * textsoftware_ ;
@ -116,24 +115,24 @@ class pngwriter
double screengamma_ ;
void circle_aux ( int xcentre , int ycentre , int x , int y , int red , int green , int blue ) ;
void circle_aux_blend ( int xcentre , int ycentre , int x , int y , double opacity , int red , int green , int blue ) ;
int check_if_png ( char * file_name , FILE * * fp ) ;
int read_png_info ( FILE * fp , png_structp * png_ptr , png_infop * info_ptr ) ;
int read_png_image ( FILE * fp , png_structp png_ptr , png_infop info_ptr ,
png_bytepp * image , png_uint_32 * width , png_uint_32 * height ) ;
void flood_fill_internal ( int xstart , int ystart , double start_red , double start_green , double start_blue , double fill_red , double fill_green , double fill_blue ) ;
void flood_fill_internal_blend ( int xstart , int ystart , double opacity , double start_red , double start_green , double start_blue , double fill_red , double fill_green , double fill_blue ) ;
int check_if_png ( char * file_name , FILE * * fp ) ;
int read_png_info ( FILE * fp , png_structp * png_ptr , png_infop * info_ptr ) ;
int read_png_image ( FILE * fp , png_structp png_ptr , png_infop info_ptr ,
png_bytepp * image , png_uint_32 * width , png_uint_32 * height ) ;
void flood_fill_internal ( int xstart , int ystart , double start_red , double start_green , double start_blue , double fill_red , double fill_green , double fill_blue ) ;
void flood_fill_internal_blend ( int xstart , int ystart , double opacity , double start_red , double start_green , double start_blue , double fill_red , double fill_green , double fill_blue ) ;
# ifndef NO_FREETYPE
void my_draw_bitmap ( FT_Bitmap * bitmap , int x , int y , double red , double green , double blue ) ;
void my_draw_bitmap_blend ( FT_Bitmap * bitmap , int x , int y , double opacity , double red , double green , double blue ) ;
void my_draw_bitmap ( FT_Bitmap * bitmap , int x , int y , double red , double green , double blue ) ;
void my_draw_bitmap_blend ( FT_Bitmap * bitmap , int x , int y , double opacity , double red , double green , double blue ) ;
# endif
/* The algorithms HSVtoRGB and RGBtoHSV were found at http://www.cs.rit.edu/~ncs/
* which is a page that belongs to Nan C . Schaller , though
* these algorithms appear to be the work of Eugene Vishnevsky .
* */
void HSVtoRGB ( double * r , double * g , double * b , double h , double s , double v ) ;
void RGBtoHSV ( float r , float g , float b , float * h , float * s , float * v ) ;
void HSVtoRGB ( double * r , double * g , double * b , double h , double s , double v ) ;
void RGBtoHSV ( float r , float g , float b , float * h , float * s , float * v ) ;
/* drwatop(), drawbottom() and filledtriangle() were contributed by Gurkan Sengun
* ( < gurkan @ linuks . mine . nu > , http : //www.linuks.mine.nu/ )
@ -143,7 +142,7 @@ class pngwriter
void drawbottom_blend ( long x1 , long y1 , long x2 , long x3 , long y3 , double opacity , int red , int green , int blue ) ;
void drawtop_blend ( long x1 , long y1 , long x2 , long y2 , long x3 , double opacity , int red , int green , int blue ) ;
public :
public :
/* General Notes
* It is important to remember that all functions that accept an argument of type " const char * " will also
@ -189,11 +188,11 @@ class pngwriter
* readfromfile ( ) .
* */
pngwriter ( ) ;
pngwriter ( const pngwriter & rhs ) ;
pngwriter ( int width , int height , int backgroundcolour , char * filename ) ;
pngwriter ( int width , int height , double backgroundcolour , char * filename ) ;
pngwriter ( int width , int height , int backgroundcolour , const char * filename ) ;
pngwriter ( int width , int height , double backgroundcolour , const char * filename ) ;
pngwriter ( const pngwriter & rhs ) ;
pngwriter ( int width , int height , int backgroundcolour , char * filename ) ;
pngwriter ( int width , int height , double backgroundcolour , char * filename ) ;
pngwriter ( int width , int height , int backgroundcolour , const char * filename ) ;
pngwriter ( int width , int height , double backgroundcolour , const char * filename ) ;
/* Destructor
* */
@ -201,7 +200,7 @@ class pngwriter
/* Assignment Operator
* */
pngwriter & operator = ( const pngwriter & rhs ) ;
pngwriter & operator = ( const pngwriter & rhs ) ;
/* Plot
* With this function a pixel at coordinates ( x , y ) can be set to the desired colour .
@ -307,8 +306,8 @@ class pngwriter
* 0000000077. png
* Tip : Use this to create sequences of images for movie generation .
* */
void pngwriter_rename ( char * newname ) ;
void pngwriter_rename ( const char * newname ) ;
void pngwriter_rename ( char * newname ) ;
void pngwriter_rename ( const char * newname ) ;
void pngwriter_rename ( long unsigned int index ) ;
/* Figures
@ -348,8 +347,8 @@ class pngwriter
* reading them into a new instance of PNGwriter . New instances of PNGwriter are 16 - bit by default .
* */
void readfromfile ( char * name ) ;
void readfromfile ( const char * name ) ;
void readfromfile ( char * name ) ;
void readfromfile ( const char * name ) ;
/* Get Height
* When you open a PNG with readfromfile ( ) you can find out its height with this function .
@ -409,13 +408,13 @@ class pngwriter
* Moving the handles lets you modify the shape of the curve .
* */
void bezier ( int startPtX , int startPtY ,
void bezier ( int startPtX , int startPtY ,
int startControlX , int startControlY ,
int endPtX , int endPtY ,
int endControlX , int endControlY ,
double red , double green , double blue ) ;
void bezier ( int startPtX , int startPtY ,
void bezier ( int startPtX , int startPtY ,
int startControlX , int startControlY ,
int endPtX , int endPtY ,
int endControlX , int endControlY ,
@ -424,8 +423,8 @@ class pngwriter
/* Set Text
* Sets the text information in the PNG header . If it is not called , the default is used .
*/
void settext ( char * title , char * author , char * description , char * software ) ;
void settext ( const char * title , const char * author , const char * description , const char * software ) ;
void settext ( char * title , char * author , char * description , char * software ) ;
void settext ( const char * title , const char * author , const char * description , const char * software ) ;
/* Version Number
@ -450,8 +449,8 @@ class pngwriter
* Tip : PNGwriter installs a few fonts in / usr / local / share / pngwriter / fonts to get you started .
* Tip : Remember to add - DNO_FREETYPE to your compilation flags if PNGwriter was compiled without FreeType support .
* */
void plot_text ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double red , double green , double blue ) ;
void plot_text ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , int red , int green , int blue ) ;
void plot_text ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double red , double green , double blue ) ;
void plot_text ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , int red , int green , int blue ) ;
/* Plot UTF-8 Text
@ -461,8 +460,8 @@ class pngwriter
* Tip : The quickest way to get a string into UTF - 8 is to write it in an adequate text editor , and save it as a file
* in UTF - 8 encoding , which can then be read in in binary mode .
* */
void plot_text_utf8 ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double red , double green , double blue ) ;
void plot_text_utf8 ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , int red , int green , int blue ) ;
void plot_text_utf8 ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double red , double green , double blue ) ;
void plot_text_utf8 ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , int red , int green , int blue ) ;
/* Bilinear Interpolation of Image
@ -525,8 +524,8 @@ class pngwriter
* of points , your program will either segfault or produce points at nonsensical coordinates .
* The colour components are either doubles from 0.0 to 1.0 or ints from 0 to 65535.
* */
void polygon ( int * points , int number_of_points , double red , double green , double blue ) ;
void polygon ( int * points , int number_of_points , int red , int green , int blue ) ;
void polygon ( int * points , int number_of_points , double red , double green , double blue ) ;
void polygon ( int * points , int number_of_points , int red , int green , int blue ) ;
/* Plot CMYK
* Plot a point in the Cyan , Magenta , Yellow , Black colourspace . Please note that this colourspace is
@ -598,25 +597,25 @@ class pngwriter
void filledcircle_blend ( int xcentre , int ycentre , int radius , double opacity , int red , int green , int blue ) ;
void filledcircle_blend ( int xcentre , int ycentre , int radius , double opacity , double red , double green , double blue ) ;
void bezier_blend ( int startPtX , int startPtY ,
void bezier_blend ( int startPtX , int startPtY ,
int startControlX , int startControlY ,
int endPtX , int endPtY ,
int endControlX , int endControlY ,
double opacity ,
double red , double green , double blue ) ;
void bezier_blend ( int startPtX , int startPtY ,
void bezier_blend ( int startPtX , int startPtY ,
int startControlX , int startControlY ,
int endPtX , int endPtY ,
int endControlX , int endControlY ,
double opacity ,
int red , int green , int blue ) ;
void plot_text_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , double red , double green , double blue ) ;
void plot_text_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , int red , int green , int blue ) ;
void plot_text_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , double red , double green , double blue ) ;
void plot_text_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , int red , int green , int blue ) ;
void plot_text_utf8_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , double red , double green , double blue ) ;
void plot_text_utf8_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , int red , int green , int blue ) ;
void plot_text_utf8_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , double red , double green , double blue ) ;
void plot_text_utf8_blend ( char * face_path , int fontsize , int x_start , int y_start , double angle , char * text , double opacity , int red , int green , int blue ) ;
void boundary_fill_blend ( int xstart , int ystart , double opacity , double boundary_red , double boundary_green , double boundary_blue , double fill_red , double fill_green , double fill_blue ) ;
void boundary_fill_blend ( int xstart , int ystart , double opacity , int boundary_red , int boundary_green , int boundary_blue , int fill_red , int fill_green , int fill_blue ) ;
@ -624,8 +623,8 @@ class pngwriter
void flood_fill_blend ( int xstart , int ystart , double opacity , double fill_red , double fill_green , double fill_blue ) ;
void flood_fill_blend ( int xstart , int ystart , double opacity , int fill_red , int fill_green , int fill_blue ) ;
void polygon_blend ( int * points , int number_of_points , double opacity , double red , double green , double blue ) ;
void polygon_blend ( int * points , int number_of_points , double opacity , int red , int green , int blue ) ;
void polygon_blend ( int * points , int number_of_points , double opacity , double red , double green , double blue ) ;
void polygon_blend ( int * points , int number_of_points , double opacity , int red , int green , int blue ) ;
void plotCMYK_blend ( int x , int y , double opacity , double cyan , double magenta , double yellow , double black ) ;
void plotCMYK_blend ( int x , int y , double opacity , int cyan , int magenta , int yellow , int black ) ;
@ -682,11 +681,11 @@ class pngwriter
* Tip : An angle of 10 to 30 degrees looks OK .
* */
void arrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , double red , double green , double blue ) ;
void arrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , int red , int green , int blue ) ;
void arrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , double red , double green , double blue ) ;
void arrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , int red , int green , int blue ) ;
void filledarrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , double red , double green , double blue ) ;
void filledarrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , int red , int green , int blue ) ;
void filledarrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , double red , double green , double blue ) ;
void filledarrow ( int x1 , int y1 , int x2 , int y2 , int size , double head_angle , int red , int green , int blue ) ;
/* Cross, Maltese Cross
* Plots a simple cross at x , y , with the specified height and width , and in the specified colour .
@ -703,21 +702,21 @@ class pngwriter
* - - - - -
* */
void cross ( int x , int y , int xwidth , int yheight , double red , double green , double blue ) ;
void cross ( int x , int y , int xwidth , int yheight , int red , int green , int blue ) ;
void cross ( int x , int y , int xwidth , int yheight , double red , double green , double blue ) ;
void cross ( int x , int y , int xwidth , int yheight , int red , int green , int blue ) ;
void maltesecross ( int x , int y , int xwidth , int yheight , int x_bar_height , int y_bar_width , double red , double green , double blue ) ;
void maltesecross ( int x , int y , int xwidth , int yheight , int x_bar_height , int y_bar_width , int red , int green , int blue ) ;
void maltesecross ( int x , int y , int xwidth , int yheight , int x_bar_height , int y_bar_width , double red , double green , double blue ) ;
void maltesecross ( int x , int y , int xwidth , int yheight , int x_bar_height , int y_bar_width , int red , int green , int blue ) ;
/* Diamond and filled diamond
* Plots a diamond shape , given the x , y position , the width and height , and the colour .
* Filled diamond plots a filled diamond .
* */
void filleddiamond ( int x , int y , int width , int height , int red , int green , int blue ) ;
void filleddiamond ( int x , int y , int width , int height , int red , int green , int blue ) ;
void diamond ( int x , int y , int width , int height , int red , int green , int blue ) ;
void filleddiamond ( int x , int y , int width , int height , double red , double green , double blue ) ;
void filleddiamond ( int x , int y , int width , int height , double red , double green , double blue ) ;
void diamond ( int x , int y , int width , int height , double red , double green , double blue ) ;
/* Get Text Width, Get Text Width UTF8
@ -735,9 +734,9 @@ class pngwriter
* 4 ( x_start - size * sin ( angle ) , y_start + size * cos ( angle ) )
* */
int get_text_width ( char * face_path , int fontsize , char * text ) ;
int get_text_width ( char * face_path , int fontsize , char * text ) ;
int get_text_width_utf8 ( char * face_path , int fontsize , char * text ) ;
int get_text_width_utf8 ( char * face_path , int fontsize , char * text ) ;
} ;