diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cd.h | 19 | ||||
-rw-r--r-- | include/cd_private.h | 62 |
2 files changed, 49 insertions, 32 deletions
diff --git a/include/cd.h b/include/cd.h index fd8348b..cf4d678 100644 --- a/include/cd.h +++ b/include/cd.h @@ -113,11 +113,12 @@ int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode); void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color); void cdCanvasMark(cdCanvas* canvas, int x, int y); -void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2); void cdCanvasBegin(cdCanvas* canvas, int mode); -void cdCanvasVertex(cdCanvas* canvas, int x, int y); void cdCanvasPathSet(cdCanvas* canvas, int action); void cdCanvasEnd(cdCanvas* canvas); + +void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2); +void cdCanvasVertex(cdCanvas* canvas, int x, int y); void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2); @@ -153,7 +154,7 @@ unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m); void cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern); long* cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m); int cdCanvasFillMode(cdCanvas* canvas, int mode); -int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size); +int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size); void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size); char* cdCanvasNativeFont(cdCanvas* canvas, const char* font); int cdCanvasTextAlignment(cdCanvas* canvas, int alignment); @@ -166,13 +167,13 @@ void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s); void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s); /* vector text attributes */ -char *cdCanvasVectorFont(cdCanvas* canvas, const char *filename); -void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2); +char* cdCanvasVectorFont(cdCanvas* canvas, const char *filename); +void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2); double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix); -void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s); -int cdCanvasVectorCharSize(cdCanvas* canvas, int size); -void cdCanvasVectorFontSize(cdCanvas* canvas, double size_x, double size_y); -void cdCanvasGetVectorFontSize(cdCanvas* canvas, double *size_x, double *size_y); +void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s); +int cdCanvasVectorCharSize(cdCanvas* canvas, int size); +void cdCanvasVectorFontSize(cdCanvas* canvas, double size_x, double size_y); +void cdCanvasGetVectorFontSize(cdCanvas* canvas, double *size_x, double *size_y); /* vector text properties */ void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y); diff --git a/include/cd_private.h b/include/cd_private.h index d2fb66b..28b92d8 100644 --- a/include/cd_private.h +++ b/include/cd_private.h @@ -310,6 +310,11 @@ int cdParseXWinFont(const char *nativefont, char *type_face, int *style, int *si int cdGetFontSizePixels(cdCanvas* canvas, int size); int cdGetFontSizePoints(cdCanvas* canvas, int size); +/* Replacements for Font using estimation */ +/* cdfontex.c */ +void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent); +void cdgettextsizeEX(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height); + /****************/ /* For Images */ /****************/ @@ -331,44 +336,55 @@ int cdCalcZoom(int canvas_size, int cnv_rect_pos, int cnv_rect_size, /**************/ /* simulation */ /**************/ + +/* sim.c */ cdSimulation* cdCreateSimulation(cdCanvas* canvas); void cdKillSimulation(cdSimulation* simulation); void cdSimInitText(cdSimulation* simulation); -/* Replacements for cdCanvas function pointers */ -void cdrectSIM(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax); -void cdboxSIM(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax); -void cdlineSIM(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2); -void cdarcSIM(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); -void cdsectorSIM(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); -void cdchordSIM(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); -void cdpolySIM(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int n); - /* Replacements for Text and Font using FreeType library */ -void cdtextSIM(cdCtxCanvas* ctxcanvas, int x, int y, const char *s, int len); -int cdfontSIM(cdCtxCanvas* ctxcanvas, const char *type_face, int style, int size); -void cdgetfontdimSIM(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent); -void cdgettextsizeSIM(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height); +/* sim_text.c */ +void cdSimTextFT(cdCtxCanvas* ctxcanvas, int x, int y, const char *s, int len); +int cdSimFontFT(cdCtxCanvas* ctxcanvas, const char *type_face, int style, int size); +void cdSimGetFontDimFT(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent); +void cdSimGetTextSizeFT(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height); + +/* sim_primitives.c */ -/* Simulation functions that are independent of the simulation base driver */ +/* Simulation functions that depend on the simulation base driver. */ +void cdSimPolyFill(cdCanvas* canvas, cdPoint* poly, int n); +void cdSimPolyLine(cdCanvas* canvas, const cdPoint* poly, int n); +void cdfSimPolyLine(cdCanvas* canvas, const cdfPoint* poly, int n); + +/* Simulation functions that are >> independent << of the simulation base driver. */ void cdSimMark(cdCanvas* canvas, int x, int y); +void cdSimPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, const unsigned char *a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax); + +/* Simulation functions that are >> independent << of the simulation base driver. + All use the polygon method ->cxPoly only. */ +void cdSimLine(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2); +void cdSimRect(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax); +void cdSimBox(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax); +void cdSimArc(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); +void cdSimSector(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); +void cdSimChord(cdCtxCanvas* ctxcanvas, int xc, int yc, int width, int height, double angle1, double angle2); void cdSimPolyBezier(cdCanvas* canvas, const cdPoint* points, int n); void cdSimPolyPath(cdCanvas* canvas, const cdPoint* points, int n); -void cdSimPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, const unsigned char *a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax); -/* Simulation functions that are independent of the simulation base driver, - and does not checks for axis and matrix. +/* Simulation functions that are >> independent << of the simulation base driver. All use the polygon method ->cxFPoly only. */ -void cdfSimPolyBezier(cdCanvas* canvas, const cdfPoint* points, int n); -void cdfSimPolyPath(cdCanvas* canvas, const cdfPoint* points, int n); +void cdfSimLine(cdCtxCanvas* ctxcanvas, double x1, double y1, double x2, double y2); void cdfSimRect(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax); void cdfSimBox(cdCtxCanvas *ctxcanvas, double xmin, double xmax, double ymin, double ymax); -void cdfSimElipse(cdCtxCanvas* ctxcanvas, double xc, double yc, double width, double height, double angle1, double angle2, int sector); void cdfSimArc(cdCtxCanvas *ctxcanvas, double xc, double yc, double width, double height, double angle1, double angle2); +void cdfSimSector(cdCtxCanvas *ctxcanvas, double xc, double yc, double width, double height, double angle1, double angle2); +void cdfSimChord(cdCtxCanvas *ctxcanvas, double xc, double yc, double width, double height, double angle1, double angle2); +void cdfSimPolyBezier(cdCanvas* canvas, const cdfPoint* points, int n); +void cdfSimPolyPath(cdCanvas* canvas, const cdfPoint* points, int n); -/* Replacements for Font using estimation */ -void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent); -void cdgettextsizeEX(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height); +/* Utilities */ +void cdSimPoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int n); +int cdSimCalcEllipseNumSegments(cdCanvas* canvas, int xc, int yc, int width, int height); #ifdef __cplusplus |