chore: 移除未使用的CD库文件并优化构建配置

删除libs/CD目录下的所有二进制库文件(.dll和.a)及对应的头文件,这些文件在项目中并未实际使用。
同时更新CMakeLists.txt,仅复制必需的IUP DLL文件到构建输出目录,减少不必要的文件拷贝。
This commit is contained in:
2026-03-19 20:07:39 +08:00
parent c92d20b4b3
commit 2ec22eaae0
62 changed files with 4 additions and 3390 deletions
+4 -4
View File
@@ -65,11 +65,11 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
advapi32 advapi32
) )
# 编译完成后, DLL 文件复制到构建输出目录 # 编译完成后,仅将程序实际需要的核心 DLL 文件复制到构建输出目录
file(GLOB IUP_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/IUP/*.dll") set(IUP_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/IUP/iup.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${IUP_DLLS} ${IUP_REQUIRED_DLLS}
"$<TARGET_FILE_DIR:${PROJECT_NAME}>" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copying DLLs to build directory..." COMMENT "Copying required DLLs to build directory..."
) )
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
-556
View File
@@ -1,556 +0,0 @@
/** \file
* \brief User API
* CD - Canvas Draw
* Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
* http://www.tecgraf.puc-rio.br/cd
* mailto:cd@tecgraf.puc-rio.br
*
* See Copyright Notice at the end of this file
*/
#ifndef __CD_H
#define __CD_H
#ifdef __cplusplus
extern "C" {
#endif
#define CD_NAME "CD - A 2D Graphics Library"
#define CD_DESCRIPTION "Vector Graphics Toolkit with Device Independent Output"
#define CD_COPYRIGHT "Copyright (C) 1994-2020 Tecgraf/PUC-Rio"
#define CD_VERSION "5.14" /* bug fixes are reported only by cdVersion functions */
#define CD_VERSION_NUMBER 514000
#define CD_VERSION_DATE "2020/07/30" /* does not include bug fix releases */
typedef struct _cdContext cdContext;
typedef struct _cdCanvas cdCanvas;
typedef struct _cdCanvas cdState;
typedef struct _cdImage cdImage;
/* client images using bitmap structure */
typedef struct _cdBitmap {
int w;
int h;
int type;
void *data;
} cdBitmap;
/* library */
char* cdVersion(void);
char* cdVersionDate(void);
int cdVersionNumber(void);
/* canvas init */
cdCanvas* cdCreateCanvas(cdContext *context, void *data);
cdCanvas* cdCreateCanvasf(cdContext *context, const char* format, ...);
void cdKillCanvas(cdCanvas* canvas);
cdContext* cdCanvasGetContext(cdCanvas* canvas);
int cdCanvasActivate(cdCanvas* canvas);
void cdCanvasDeactivate(cdCanvas* canvas);
int cdUseContextPlus(int use);
void cdInitContextPlus(void); /* need an external library */
void cdFinishContextPlus(void); /* need an external library */
/* context */
typedef int (*cdCallback)(cdCanvas* canvas, ...);
int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
unsigned long cdContextCaps(cdContext *context);
int cdContextIsPlus(cdContext *context);
int cdContextType(cdContext *context);
/* control */
int cdCanvasSimulate(cdCanvas* canvas, int mode);
void cdCanvasFlush(cdCanvas* canvas);
void cdCanvasClear(cdCanvas* canvas);
cdState* cdCanvasSaveState(cdCanvas* canvas);
void cdCanvasRestoreState(cdCanvas* canvas, cdState* state);
void cdReleaseState(cdState* state);
void cdCanvasSetAttribute(cdCanvas* canvas, const char* name, char* data);
void cdCanvasSetfAttribute(cdCanvas* canvas, const char* name, const char* format, ...);
char* cdCanvasGetAttribute(cdCanvas* canvas, const char* name);
/* interpretation */
int cdCanvasPlay(cdCanvas* canvas, cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);
/* coordinate transformation */
void cdCanvasGetSize(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm);
int cdCanvasUpdateYAxis(cdCanvas* canvas, int* y);
double cdfCanvasUpdateYAxis(cdCanvas* canvas, double* y);
int cdCanvasInvertYAxis(cdCanvas* canvas, int y);
double cdfCanvasInvertYAxis(cdCanvas* canvas, double y);
void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy);
void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy);
void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy);
void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy);
void cdCanvasOrigin(cdCanvas* canvas, int x, int y);
void cdfCanvasOrigin(cdCanvas* canvas, double x, double y);
void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y);
void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y);
void cdCanvasTransform(cdCanvas* canvas, const double* matrix);
double* cdCanvasGetTransform(cdCanvas* canvas);
void cdCanvasTransformMultiply(cdCanvas* canvas, const double* matrix);
void cdCanvasTransformRotate(cdCanvas* canvas, double angle);
void cdCanvasTransformScale(cdCanvas* canvas, double sx, double sy);
void cdCanvasTransformTranslate(cdCanvas* canvas, double dx, double dy);
void cdCanvasTransformPoint(cdCanvas* canvas, int x, int y, int *tx, int *ty);
void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty);
/* clipping */
int cdCanvasClip(cdCanvas* canvas, int mode);
void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
int cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
int cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
/* clipping region */
int cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y);
void cdCanvasOffsetRegion(cdCanvas* canvas, int x, int y);
void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);
/* primitives */
void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
void cdCanvasMark(cdCanvas* canvas, int x, int y);
void cdfCanvasPixel(cdCanvas* canvas, double x, double y, long color);
void cdfCanvasMark(cdCanvas* canvas, double x, double y);
void cdCanvasBegin(cdCanvas* canvas, int mode);
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);
void cdCanvasSector(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
void cdCanvasChord(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
void cdCanvasText(cdCanvas* canvas, int x, int y, const char* s);
void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
void cdfCanvasVertex(cdCanvas* canvas, double x, double y);
void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* s);
/* attributes */
void cdCanvasSetBackground(cdCanvas* canvas, long color);
void cdCanvasSetForeground(cdCanvas* canvas, long color);
long cdCanvasBackground(cdCanvas* canvas, long color);
long cdCanvasForeground(cdCanvas* canvas, long color);
int cdCanvasBackOpacity(cdCanvas* canvas, int opacity);
int cdCanvasWriteMode(cdCanvas* canvas, int mode);
int cdCanvasLineStyle(cdCanvas* canvas, int style);
void cdCanvasLineStyleDashes(cdCanvas* canvas, const int* dashes, int count);
int cdCanvasLineWidth(cdCanvas* canvas, int width);
int cdCanvasLineJoin(cdCanvas* canvas, int join);
int cdCanvasLineCap(cdCanvas* canvas, int cap);
int cdCanvasInteriorStyle(cdCanvas* canvas, int style);
int cdCanvasHatch(cdCanvas* canvas, int style);
void cdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char* stipple);
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);
void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
char* cdCanvasNativeFont(cdCanvas* canvas, const char* font);
int cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
double cdCanvasTextOrientation(cdCanvas* canvas, double angle);
int cdCanvasMarkType(cdCanvas* canvas, int type);
int cdCanvasMarkSize(cdCanvas* canvas, int size);
/* vector text */
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);
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);
/* vector text properties */
void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
void cdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, int x, int y, int *rect);
void cdCanvasGetVectorTextBox(cdCanvas* canvas, int x, int y, const char *s, int *xmin, int *xmax, int *ymin, int *ymax);
void cdfCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2);
void cdfCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const char* s);
void cdfCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, double *x, double *y);
double cdfCanvasVectorCharSize(cdCanvas* canvas, double size);
void cdfCanvasVectorText(cdCanvas* canvas, double x, double y, const char* s);
void cdfCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const char* s);
void cdfCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, double x, double y, double *rect);
void cdfCanvasGetVectorTextBox(cdCanvas* canvas, double x, double y, const char *s, double *xmin, double *xmax, double *ymin, double *ymax);
/* properties */
void cdCanvasGetFontDim(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent);
void cdCanvasGetTextSize(cdCanvas* canvas, const char* s, int *width, int *height);
void cdCanvasGetTextBox(cdCanvas* canvas, int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
void cdfCanvasGetTextBox(cdCanvas* canvas, double x, double y, const char *s, double *xmin, double *xmax, double *ymin, double *ymax);
void cdCanvasGetTextBounds(cdCanvas* canvas, int x, int y, const char* s, int *rect);
void cdfCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char *s, double *rect);
int cdCanvasGetColorPlanes(cdCanvas* canvas);
/* color */
void cdCanvasPalette(cdCanvas* canvas, int n, const long *palette, int mode);
/* client images */
void cdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int iw, int ih);
void cdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdCanvasPutImageRectRGBA(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);
void cdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdfCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void cdfCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void cdfCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
/* server images - deprecated (use double buffer drivers) */
cdImage* cdCanvasCreateImage(cdCanvas* canvas, int w, int h);
void cdKillImage(cdImage* image);
void cdCanvasGetImage(cdCanvas* canvas, cdImage* image, int x, int y);
void cdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
void cdCanvasScrollArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
/* bitmap - deprecated (use imImage) */
cdBitmap* cdCreateBitmap(int w, int h, int type);
cdBitmap* cdInitBitmap(int w, int h, int type, ...);
void cdKillBitmap(cdBitmap* bitmap);
unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);
/* color */
long cdEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
long cdEncodeColorAlpha(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
long cdEncodeAlpha(long color, unsigned char alpha);
void cdDecodeColor(long color, unsigned char* red, unsigned char* green, unsigned char* blue);
void cdDecodeColorAlpha(long color, unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha);
unsigned char cdDecodeAlpha(long color);
#define cdAlpha(_) (unsigned char)(~(((_) >> 24) & 0xFF))
#define cdReserved(_) (unsigned char)(((_) >> 24) & 0xFF)
#define cdRed(_) (unsigned char)(((_) >> 16) & 0xFF)
#define cdGreen(_) (unsigned char)(((_) >> 8) & 0xFF)
#define cdBlue(_) (unsigned char)(((_) >> 0) & 0xFF)
/* client image color conversion */
void cdRGB2Map(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, int pal_size, long *color);
/* CD Values */
#define CD_QUERY -1 /* query value */
enum { /* bitmap type */
CD_RGB, /* these definitions are compatible with the IM library */
CD_MAP,
CD_RGBA = 0x100
};
enum { /* bitmap data */
CD_IRED,
CD_IGREEN,
CD_IBLUE,
CD_IALPHA,
CD_INDEX,
CD_COLORS
};
enum { /* status report */
CD_ERROR = -1,
CD_OK = 0
};
enum { /* clip mode */
CD_CLIPOFF,
CD_CLIPAREA,
CD_CLIPPOLYGON,
CD_CLIPREGION,
CD_CLIPPATH
};
enum { /* region combine mode */
CD_UNION,
CD_INTERSECT,
CD_DIFFERENCE,
CD_NOTINTERSECT
};
enum { /* polygon mode (begin...end) */
CD_FILL,
CD_OPEN_LINES,
CD_CLOSED_LINES,
CD_CLIP,
CD_BEZIER,
CD_REGION,
CD_PATH
};
#define CD_POLYCUSTOM 10
enum { /* path actions */
CD_PATH_NEW,
CD_PATH_MOVETO,
CD_PATH_LINETO,
CD_PATH_ARC,
CD_PATH_CURVETO,
CD_PATH_CLOSE,
CD_PATH_FILL,
CD_PATH_STROKE,
CD_PATH_FILLSTROKE,
CD_PATH_CLIP
};
enum { /* fill mode */
CD_EVENODD,
CD_WINDING
};
enum { /* line join */
CD_MITER,
CD_BEVEL,
CD_ROUND
};
enum { /* line cap */
CD_CAPFLAT,
CD_CAPSQUARE,
CD_CAPROUND
};
enum { /* background opacity mode */
CD_OPAQUE,
CD_TRANSPARENT
};
enum { /* write mode */
CD_REPLACE,
CD_XOR,
CD_NOT_XOR
};
enum { /* color allocation mode (palette) */
CD_POLITE,
CD_FORCE
};
enum { /* line style */
CD_CONTINUOUS,
CD_DASHED,
CD_DOTTED,
CD_DASH_DOT,
CD_DASH_DOT_DOT,
CD_CUSTOM
};
enum { /* marker type */
CD_PLUS,
CD_STAR,
CD_CIRCLE,
CD_X,
CD_BOX,
CD_DIAMOND,
CD_HOLLOW_CIRCLE,
CD_HOLLOW_BOX,
CD_HOLLOW_DIAMOND
};
enum { /* hatch type */
CD_HORIZONTAL,
CD_VERTICAL,
CD_FDIAGONAL,
CD_BDIAGONAL,
CD_CROSS,
CD_DIAGCROSS
};
enum { /* interior style */
CD_SOLID,
CD_HATCH,
CD_STIPPLE,
CD_PATTERN,
CD_HOLLOW,
CD_CUSTOMPATTERN /* used only in ContextPlus drivers */
};
enum { /* text alignment */
CD_NORTH,
CD_SOUTH,
CD_EAST,
CD_WEST,
CD_NORTH_EAST,
CD_NORTH_WEST,
CD_SOUTH_EAST,
CD_SOUTH_WEST,
CD_CENTER,
CD_BASE_LEFT,
CD_BASE_CENTER,
CD_BASE_RIGHT
};
enum { /* style */
CD_PLAIN = 0,
CD_BOLD = 1,
CD_ITALIC = 2,
CD_UNDERLINE = 4,
CD_STRIKEOUT = 8
};
#define CD_BOLD_ITALIC (CD_BOLD|CD_ITALIC) /* compatibility name */
enum { /* some font sizes */
CD_SMALL = 8,
CD_STANDARD = 12,
CD_LARGE = 18
};
/* Context Capabilities */
#define CD_CAP_NONE 0x00000000
#define CD_CAP_FLUSH 0x00000001
#define CD_CAP_CLEAR 0x00000002
#define CD_CAP_PLAY 0x00000004
#define CD_CAP_YAXIS 0x00000008
#define CD_CAP_CLIPAREA 0x00000010
#define CD_CAP_CLIPPOLY 0x00000020
#define CD_CAP_REGION 0x00000040
#define CD_CAP_RECT 0x00000080
#define CD_CAP_CHORD 0x00000100
#define CD_CAP_IMAGERGB 0x00000200
#define CD_CAP_IMAGERGBA 0x00000400
#define CD_CAP_IMAGEMAP 0x00000800
#define CD_CAP_GETIMAGERGB 0x00001000
#define CD_CAP_IMAGESRV 0x00002000
#define CD_CAP_BACKGROUND 0x00004000
#define CD_CAP_BACKOPACITY 0x00008000
#define CD_CAP_WRITEMODE 0x00010000
#define CD_CAP_LINESTYLE 0x00020000
#define CD_CAP_LINEWITH 0x00040000
#define CD_CAP_FPRIMTIVES 0x00080000
#define CD_CAP_HATCH 0x00100000
#define CD_CAP_STIPPLE 0x00200000
#define CD_CAP_PATTERN 0x00400000
#define CD_CAP_FONT 0x00800000
#define CD_CAP_FONTDIM 0x01000000
#define CD_CAP_TEXTSIZE 0x02000000
#define CD_CAP_TEXTORIENTATION 0x04000000
#define CD_CAP_PALETTE 0x08000000
#define CD_CAP_LINECAP 0x10000000
#define CD_CAP_LINEJOIN 0x20000000
#define CD_CAP_PATH 0x40000000
#define CD_CAP_BEZIER 0x80000000
#define CD_CAP_ALL 0xFFFFFFFF
/* Context Types */
enum {
CD_CTX_WINDOW,
CD_CTX_DEVICE,
CD_CTX_IMAGE,
CD_CTX_FILE
};
/* cdPlay definitions */
#define CD_SIZECB 0 /* size callback */
typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
#define CD_ABORT 1
#define CD_CONTINUE 0
/* simulation flags */
#define CD_SIM_NONE 0x0000
#define CD_SIM_LINE 0x0001
#define CD_SIM_RECT 0x0002
#define CD_SIM_BOX 0x0004
#define CD_SIM_ARC 0x0008
#define CD_SIM_SECTOR 0x0010
#define CD_SIM_CHORD 0x0020
#define CD_SIM_POLYLINE 0x0040
#define CD_SIM_POLYGON 0x0080
#define CD_SIM_TEXT 0x0100
#define CD_SIM_ALL 0xFFFF
#define CD_SIM_LINES (CD_SIM_LINE | CD_SIM_RECT | CD_SIM_ARC | CD_SIM_POLYLINE)
#define CD_SIM_FILLS (CD_SIM_BOX | CD_SIM_SECTOR | CD_SIM_CHORD | CD_SIM_POLYGON)
/* some predefined colors for convenience */
#define CD_RED 0xFF0000L /* 255, 0, 0 */
#define CD_DARK_RED 0x800000L /* 128, 0, 0 */
#define CD_GREEN 0x00FF00L /* 0,255, 0 */
#define CD_DARK_GREEN 0x008000L /* 0,128, 0 */
#define CD_BLUE 0x0000FFL /* 0, 0,255 */
#define CD_DARK_BLUE 0x000080L /* 0, 0,128 */
#define CD_YELLOW 0xFFFF00L /* 255,255, 0 */
#define CD_DARK_YELLOW 0x808000L /* 128,128, 0 */
#define CD_MAGENTA 0xFF00FFL /* 255, 0,255 */
#define CD_DARK_MAGENTA 0x800080L /* 128, 0,128 */
#define CD_CYAN 0x00FFFFL /* 0,255,255 */
#define CD_DARK_CYAN 0x008080L /* 0,128,128 */
#define CD_WHITE 0xFFFFFFL /* 255,255,255 */
#define CD_BLACK 0x000000L /* 0, 0, 0 */
#define CD_DARK_GRAY 0x808080L /* 128,128,128 */
#define CD_GRAY 0xC0C0C0L /* 192,192,192 */
/* some useful conversion factors */
#define CD_MM2PT 2.834645669 /* millimeters to points (pt = CD_MM2PT * mm) */
#define CD_RAD2DEG 57.295779513 /* radians to degrees (deg = CD_RAD2DEG * rad) */
#define CD_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */
/* paper sizes */
enum {
CD_A0,
CD_A1,
CD_A2,
CD_A3,
CD_A4,
CD_A5,
CD_LETTER,
CD_LEGAL
};
#ifdef __cplusplus
}
#endif
/******************************************************************************
Copyright (C) 1994-2020 Tecgraf/PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#endif /* ifndef CD_H */
-360
View File
@@ -1,360 +0,0 @@
/** \file
* \brief Canvas Class
*
* DEPRECATED API. USE NAMESPACE BASED CLASSES.
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_CANVAS_HPP
#define __CD_CANVAS_HPP
#include "cd.h"
#include "wd.h"
class cdCanvasC
{
cdCanvas* canvas;
cdCanvasC() {};
public:
/* canvas init */
cdCanvasC(cdCanvas* _canvas)
{ this->canvas = _canvas; }
~cdCanvasC()
{ cdKillCanvas(this->canvas); }
cdContext* GetContext()
{ return cdCanvasGetContext(canvas); }
int Activate()
{ return cdCanvasActivate(canvas); }
void Deactivate()
{ cdCanvasDeactivate(canvas); }
/* control */
int Simulate(int mode)
{ return cdCanvasSimulate(canvas, mode); }
void Flush()
{ cdCanvasFlush(canvas); }
void Clear()
{ cdCanvasClear(canvas); }
cdState* SaveState()
{ return cdCanvasSaveState(canvas); }
void RestoreState(cdState* state)
{ cdCanvasRestoreState(canvas, state); }
void SetAttribute(const char* name, char* data)
{ cdCanvasSetAttribute(canvas, name, data); }
char* GetAttribute(const char* name)
{ return cdCanvasGetAttribute(canvas, name); }
/* interpretation */
int Play(cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data)
{ return cdCanvasPlay(canvas, context, xmin, xmax, ymin, ymax, data); }
/* coordinate transformation */
void GetSize(int *width, int *height, double *width_mm, double *height_mm)
{ cdCanvasGetSize(canvas, width, height, width_mm, height_mm); }
int UpdateYAxis(int* y)
{ return cdCanvasUpdateYAxis(canvas, y); }
void MM2Pixel(double mm_dx, double mm_dy, int *dx, int *dy)
{ cdCanvasMM2Pixel(canvas, mm_dx, mm_dy, dx, dy); }
void Pixel2MM(int dx, int dy, double *mm_dx, double *mm_dy)
{ cdCanvasPixel2MM(canvas, dx, dy, mm_dx, mm_dy); }
void MM2Pixel(double mm_dx, double mm_dy, double *dx, double *dy)
{ cdfCanvasMM2Pixel(canvas, mm_dx, mm_dy, dx, dy); }
void Pixel2MM(double dx, double dy, double *mm_dx, double *mm_dy)
{ cdfCanvasPixel2MM(canvas, dx, dy, mm_dx, mm_dy); }
void Origin(int x, int y)
{ cdCanvasOrigin(canvas, x, y); }
void Origin(double x, double y)
{ cdfCanvasOrigin(canvas, x, y); }
void GetOrigin(int *x, int *y)
{ cdCanvasGetOrigin(canvas, x, y); }
void GetOrigin(double *x, double *y)
{ cdfCanvasGetOrigin(canvas, x, y); }
/* clipping */
int Clip(int mode)
{ return cdCanvasClip(canvas, mode); }
void ClipArea(int xmin, int xmax, int ymin, int ymax)
{ cdCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
int GetClipArea(int *xmin, int *xmax, int *ymin, int *ymax)
{ return cdCanvasGetClipArea(canvas, xmin, xmax, ymin, ymax); }
void ClipArea(double xmin, double xmax, double ymin, double ymax)
{ cdfCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
int GetClipArea(double *xmin, double *xmax, double *ymin, double *ymax)
{ return cdfCanvasGetClipArea(canvas, xmin, xmax, ymin, ymax); }
/* clipping region */
int IsPointInRegion(int x, int y)
{ return cdCanvasIsPointInRegion(canvas, x, y); }
void OffsetRegion(int x, int y)
{ cdCanvasOffsetRegion(canvas, x, y); }
void GetRegionBox(int *xmin, int *xmax, int *ymin, int *ymax)
{ cdCanvasGetRegionBox(canvas, xmin, xmax, ymin, ymax); }
int RegionCombineMode(int mode)
{ return cdCanvasRegionCombineMode(canvas, mode); }
/* primitives */
void Pixel(int x, int y, long color)
{ cdCanvasPixel(canvas, x, y, color); }
void Mark(int x, int y)
{ cdCanvasMark(canvas, x, y); }
void Line(int x1, int y1, int x2, int y2)
{ cdCanvasLine(canvas, x1, y1, x2, y2); }
void Begin(int mode)
{ cdCanvasBegin(canvas, mode); }
void Vertex(int x, int y)
{ cdCanvasVertex(canvas, x, y); }
void End()
{ cdCanvasEnd(canvas); }
void Rect(int xmin, int xmax, int ymin, int ymax)
{ cdCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void Box(int xmin, int xmax, int ymin, int ymax)
{ cdCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void Arc(int xc, int yc, int w, int h, double angle1, double angle2)
{ cdCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void Sector(int xc, int yc, int w, int h, double angle1, double angle2)
{ cdCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void Chord(int xc, int yc, int w, int h, double angle1, double angle2)
{ cdCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void Text(int x, int y, const char* s)
{ cdCanvasText(canvas, x, y, s); }
void Line(double x1, double y1, double x2, double y2)
{ cdfCanvasLine(canvas, x1, y1, x2, y2); }
void Vertex(double x, double y)
{ cdfCanvasVertex(canvas, x, y); }
void Rect(double xmin, double xmax, double ymin, double ymax)
{ cdfCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void Box(double xmin, double xmax, double ymin, double ymax)
{ cdfCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void Arc(double xc, double yc, double w, double h, double angle1, double angle2)
{ cdfCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void Sector(double xc, double yc, double w, double h, double angle1, double angle2)
{ cdfCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void Chord(double xc, double yc, double w, double h, double angle1, double angle2)
{ cdfCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void Text(double x, double y, const char* s)
{ cdfCanvasText(canvas, x, y, s); }
/* attributes */
long Background(long color)
{ return cdCanvasBackground(canvas, color); }
long Foreground(long color)
{ return cdCanvasForeground(canvas, color); }
int BackOpacity(int opacity)
{ return cdCanvasBackOpacity(canvas, opacity); }
int WriteMode(int mode)
{ return cdCanvasWriteMode(canvas, mode); }
int LineStyle(int style)
{ return cdCanvasLineStyle(canvas, style); }
void LineStyleDashes(const int* dashes, int count)
{ cdCanvasLineStyleDashes(canvas, dashes, count); }
int LineWidth(int width)
{ return cdCanvasLineWidth(canvas, width); }
int LineJoin(int join)
{ return cdCanvasLineJoin(canvas, join); }
int LineCap(int cap)
{ return cdCanvasLineCap(canvas, cap); }
int InteriorStyle(int style)
{ return cdCanvasInteriorStyle(canvas, style); }
int Hatch(int style)
{ return cdCanvasHatch(canvas, style); }
void Stipple(int w, int h, const unsigned char* stipple)
{ cdCanvasStipple(canvas, w, h, stipple); }
unsigned char* GetStipple(int *n, int *m)
{ return cdCanvasGetStipple(canvas, n, m); }
void Pattern(int w, int h, long const int *pattern)
{ cdCanvasPattern(canvas, w, h, pattern); }
long* GetPattern(int* n, int* m)
{ return cdCanvasGetPattern(canvas, n, m); }
int FillMode(int mode)
{ return cdCanvasFillMode(canvas, mode); }
int Font(const char* type_face, int style, int size)
{ return cdCanvasFont(canvas, type_face, style, size); }
void GetFont(char *type_face, int *style, int *size)
{ cdCanvasGetFont(canvas, type_face, style, size); }
char* NativeFont(const char* font)
{ return cdCanvasNativeFont(canvas, font); }
int TextAlignment(int alignment)
{ return cdCanvasTextAlignment(canvas, alignment); }
double TextOrientation(double angle)
{ return cdCanvasTextOrientation(canvas, angle); }
int MarkType(int type)
{ return cdCanvasMarkType(canvas, type); }
int MarkSize(int size)
{ return cdCanvasMarkSize(canvas, size); }
/* vector text */
void VectorText(int x, int y, const char* s)
{ cdCanvasVectorText(canvas, x, y, s); }
void MultiLineVectorText(int x, int y, const char* s)
{ cdCanvasMultiLineVectorText(canvas, x, y, s); }
/* vector text attributes */
char *VectorFont(const char *filename)
{ return cdCanvasVectorFont(canvas, filename); }
void VectorTextDirection(int x1, int y1, int x2, int y2)
{ cdCanvasVectorTextDirection(canvas, x1, y1, x2, y2); }
double* VectorTextTransform(const double* matrix)
{ return cdCanvasVectorTextTransform(canvas, matrix); }
void VectorTextSize(int size_x, int size_y, const char* s)
{ cdCanvasVectorTextSize(canvas, size_x, size_y, s); }
int VectorCharSize(int size)
{ return cdCanvasVectorCharSize(canvas, size); }
/* vector text properties */
void GetVectorTextSize(const char* s, int *x, int *y)
{ cdCanvasGetVectorTextSize(canvas, s, x, y); }
void GetVectorTextBounds(const char* s, int x, int y, int *rect)
{ cdCanvasGetVectorTextBounds(canvas, s, x, y, rect); }
/* properties */
void GetFontDim(int *max_width, int *height, int *ascent, int *descent)
{ cdCanvasGetFontDim(canvas, max_width, height, ascent, descent); }
void GetTextSize(const char* s, int *width, int *height)
{ cdCanvasGetTextSize(canvas, s, width, height); }
void GetTextBox(int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax)
{ cdCanvasGetTextBox(canvas, x, y, s, xmin, xmax, ymin, ymax); }
void GetTextBounds(int x, int y, const char* s, int *rect)
{ cdCanvasGetTextBounds(canvas, x, y, s, rect); }
int GetColorPlanes()
{ return cdCanvasGetColorPlanes(canvas); }
/* color */
void Palette(int n, const long *palette, int mode)
{ cdCanvasPalette(canvas, n, palette, mode); }
/* client images */
void GetImageRGB(unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h)
{ cdCanvasGetImageRGB(canvas, r, g, b, x, y, w, h); }
void PutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{ cdCanvasPutImageRectRGB(canvas, iw, ih, r, g, b, x, y, w, h, xmin, xmax, ymin, ymax); }
void PutImageRectRGBA(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)
{ cdCanvasPutImageRectRGBA(canvas, iw, ih, r, g, b, a, x, y, w, h, xmin, xmax, ymin, ymax); }
void PutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{ cdCanvasPutImageRectMap(canvas, iw, ih, index, colors, x, y, w, h, xmin, xmax, ymin, ymax); }
/* server images */
cdImage* CreateImage(int w, int h)
{ return cdCanvasCreateImage(canvas, w, h); }
void GetImage(cdImage* image, int x, int y)
{ cdCanvasGetImage(canvas, image, x, y); }
void PutImageRect(cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax)
{ cdCanvasPutImageRect(canvas, image, x, y, xmin, xmax, ymin, ymax); }
void ScrollArea(int xmin, int xmax, int ymin, int ymax, int dx, int dy)
{ cdCanvasScrollArea(canvas, xmin, xmax, ymin, ymax, dx, dy); }
void PutBitmap(cdBitmap* bitmap, int x, int y, int w, int h)
{ cdCanvasPutBitmap(canvas, bitmap, x, y, w, h); }
void GetBitmap(cdBitmap* bitmap, int x, int y)
{ cdCanvasGetBitmap(canvas, bitmap, x, y); }
/* coordinate transformation */
void wWindow(double xmin, double xmax, double ymin, double ymax)
{ wdCanvasWindow(canvas, xmin, xmax, ymin, ymax); }
void wGetWindow(double *xmin, double *xmax, double *ymin, double *ymax)
{ wdCanvasGetWindow(canvas, xmin, xmax, ymin, ymax); }
void wViewport(int xmin, int xmax, int ymin, int ymax)
{ wdCanvasViewport(canvas, xmin, xmax, ymin, ymax); }
void wGetViewport(int *xmin, int *xmax, int *ymin, int *ymax)
{ wdCanvasGetViewport(canvas, xmin, xmax, ymin, ymax); }
void wWorld2Canvas(double xw, double yw, int *xv, int *yv)
{ wdCanvasWorld2Canvas(canvas, xw, yw, xv, yv); }
void wWorld2CanvasSize(double hw, double vw, int *hv, int *vv)
{ wdCanvasWorld2CanvasSize(canvas, hw, vw, hv, vv); }
void wCanvas2World(int xv, int yv, double *xw, double *yw)
{ wdCanvasCanvas2World(canvas, xv, yv, xw, yw); }
void wClipArea(double xmin, double xmax, double ymin, double ymax)
{ wdCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
int wGetClipArea(double *xmin, double *xmax, double *ymin, double *ymax)
{ return wdCanvasGetClipArea(canvas, xmin, xmax, ymin, ymax); }
int wIsPointInRegion(double x, double y)
{ return wdCanvasIsPointInRegion(canvas, x, y); }
void wOffsetRegion(double x, double y)
{ wdCanvasOffsetRegion(canvas, x, y); }
void wGetRegionBox(double *xmin, double *xmax, double *ymin, double *ymax)
{ wdCanvasGetRegionBox(canvas, xmin, xmax, ymin, ymax); }
/* primitives */
void wPixel(double x, double y, long color)
{ wdCanvasPixel(canvas, x, y, color); }
void wMark(double x, double y)
{ wdCanvasMark(canvas, x, y); }
void wLine(double x1, double y1, double x2, double y2)
{ wdCanvasLine(canvas, x1, y1, x2, y2); }
void wVertex(double x, double y)
{ wdCanvasVertex(canvas, x, y); }
void wRect(double xmin, double xmax, double ymin, double ymax)
{ wdCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void wBox(double xmin, double xmax, double ymin, double ymax)
{ wdCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void wArc(double xc, double yc, double w, double h, double angle1, double angle2)
{ wdCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void wSector(double xc, double yc, double w, double h, double angle1, double angle2)
{ wdCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void wChord(double xc, double yc, double w, double h, double angle1, double angle2)
{ wdCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void wText(double x, double y, const char* s)
{ wdCanvasText(canvas, x, y, s); }
void wPutImageRect(cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax)
{ wdCanvasPutImageRect(canvas, image, x, y, xmin, xmax, ymin, ymax); }
void wPutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax)
{ wdCanvasPutImageRectRGB(canvas, iw, ih, r, g, b, x, y, w, h, xmin, xmax, ymin, ymax); }
void wPutImageRectRGBA(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax)
{ wdCanvasPutImageRectRGBA(canvas, iw, ih, r, g, b, a, x, y, w, h, xmin, xmax, ymin, ymax); }
void wPutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax)
{ wdCanvasPutImageRectMap(canvas, iw, ih, index, colors, x, y, w, h, xmin, xmax, ymin, ymax); }
void wPutBitmap(cdBitmap* bitmap, double x, double y, double w, double h)
{ wdCanvasPutBitmap(canvas, bitmap, x, y, w, h); }
/* attributes */
double wLineWidth(double width)
{ return wdCanvasLineWidth(canvas, width); }
int wFont(const char* type_face, int style, double size)
{ return wdCanvasFont(canvas, type_face, style, size); }
void wGetFont(char *type_face, int *style, double *size)
{ wdCanvasGetFont(canvas, type_face, style, size); }
double wMarkSize(double size)
{ return wdCanvasMarkSize(canvas, size); }
void wGetFontDim(double *max_width, double *height, double *ascent, double *descent)
{ wdCanvasGetFontDim(canvas, max_width, height, ascent, descent); }
void wGetTextSize(const char* s, double *width, double *height)
{ wdCanvasGetTextSize(canvas, s, width, height); }
void wGetTextBox(double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax)
{ wdCanvasGetTextBox(canvas, x, y, s, xmin, xmax, ymin, ymax); }
void wGetTextBounds(double x, double y, const char* s, double *rect)
{ wdCanvasGetTextBounds(canvas, x, y, s, rect); }
void wStipple(int w, int h, const unsigned char*fgbg, double w_mm, double h_mm)
{ wdCanvasStipple(canvas, w, h, fgbg, w_mm, h_mm); }
void wPattern(int w, int h, const long *color, double w_mm, double h_mm)
{ wdCanvasPattern(canvas, w, h, color, w_mm, h_mm); }
/* vector text */
void wVectorTextDirection(double x1, double y1, double x2, double y2)
{ wdCanvasVectorTextDirection(canvas, x1, y1, x2, y2); }
void wVectorTextSize(double size_x, double size_y, const char* s)
{ wdCanvasVectorTextSize(canvas, size_x, size_y, s); }
void wGetVectorTextSize(const char* s, double *x, double *y)
{ wdCanvasGetVectorTextSize(canvas, s, x, y); }
double wVectorCharSize(double size)
{ return wdCanvasVectorCharSize(canvas, size); }
void wVectorText(double x, double y, const char* s)
{ wdCanvasVectorText(canvas, x, y, s); }
void wMultiLineVectorText(double x, double y, const char* s)
{ wdCanvasMultiLineVectorText(canvas, x, y, s); }
void wGetVectorTextBounds(const char* s, double x, double y, double *rect)
{ wdCanvasGetVectorTextBounds(canvas, s, x, y, rect); }
};
#endif
-158
View File
@@ -1,158 +0,0 @@
/** \file
* \brief Old User API
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_OLD_H
#define __CD_OLD_H
#ifdef __cplusplus
extern "C" {
#endif
/* canvas control */
int cdActivate(cdCanvas* canvas);
cdCanvas* cdActiveCanvas(void);
int cdSimulate(int mode);
void cdFlush(void);
void cdClear(void);
cdState* cdSaveState(void);
void cdRestoreState(cdState* state);
void cdSetAttribute(const char* name, char* data);
void cdSetfAttribute(const char* name, const char* format, ...);
char* cdGetAttribute(const char* name);
cdContext* cdGetContext(cdCanvas* canvas);
/* interpretation */
int cdRegisterCallback(cdContext *context, int cb, cdCallback func);
int cdPlay(cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);
/* coordinate transformation */
void cdGetCanvasSize(int *width, int *height, double *width_mm, double *height_mm);
int cdUpdateYAxis(int *y);
void cdMM2Pixel(double mm_dx, double mm_dy, int *dx, int *dy);
void cdPixel2MM(int dx, int dy, double *mm_dx, double *mm_dy);
void cdOrigin(int x, int y);
/* clipping */
int cdClip(int mode);
int * cdGetClipPoly(int *n);
void cdClipArea(int xmin, int xmax, int ymin, int ymax);
int cdGetClipArea(int *xmin, int *xmax, int *ymin, int *ymax);
/* clipping region */
int cdPointInRegion(int x, int y);
void cdOffsetRegion(int x, int y);
void cdRegionBox(int *xmin, int *xmax, int *ymin, int *ymax);
int cdRegionCombineMode(int mode);
/* primitives */
void cdPixel(int x, int y, long color);
void cdMark(int x, int y);
void cdLine(int x1, int y1, int x2, int y2);
void cdBegin(int mode);
void cdVertex(int x, int y);
void cdEnd(void);
void cdRect(int xmin, int xmax, int ymin, int ymax);
void cdBox(int xmin, int xmax, int ymin, int ymax);
void cdArc(int xc, int yc, int w, int h, double angle1, double angle2);
void cdSector(int xc, int yc, int w, int h, double angle1, double angle2);
void cdChord(int xc, int yc, int w, int h, double angle1, double angle2);
void cdText(int x, int y, const char* s);
/* attributes */
long cdBackground(long color);
long cdForeground(long color);
int cdBackOpacity(int opacity);
int cdWriteMode(int mode);
int cdLineStyle(int style);
void cdLineStyleDashes(const int* dashes, int count);
int cdLineWidth(int width);
int cdLineJoin(int join);
int cdLineCap(int cap);
int cdInteriorStyle(int style);
int cdHatch(int style);
void cdStipple(int w, int h, const unsigned char* stipple);
unsigned char* cdGetStipple(int *n, int *m);
void cdPattern(int w, int h, const long *pattern);
long* cdGetPattern(int* n, int* m);
int cdFillMode(int mode);
void cdFont(int type_face, int style, int size);
void cdGetFont(int *type_face, int *style, int *size);
char* cdNativeFont(const char* font);
int cdTextAlignment(int alignment);
double cdTextOrientation(double angle);
int cdMarkType(int type);
int cdMarkSize(int size);
/* vector text */
void cdVectorText(int x, int y, const char* s);
void cdMultiLineVectorText(int x, int y, const char* s);
/* vector text attributes */
char *cdVectorFont(const char *filename);
void cdVectorTextDirection(int x1, int y1, int x2, int y2);
double* cdVectorTextTransform(const double* matrix);
void cdVectorTextSize(int size_x, int size_y, const char* s);
int cdVectorCharSize(int size);
/* vector text properties */
void cdGetVectorTextSize(const char* s, int *x, int *y);
void cdGetVectorTextBounds(const char* s, int x, int y, int *rect);
/* properties */
void cdFontDim(int *max_width, int *height, int *ascent, int *descent);
void cdTextSize(const char* s, int *width, int *height);
void cdTextBox(int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
void cdTextBounds(int x, int y, const char* s, int *rect);
int cdGetColorPlanes(void);
/* color */
void cdPalette(int n, const long* palette, int mode);
/* client images */
void cdGetImageRGB(unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h);
void cdPutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdPutImageRectRGBA(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);
void cdPutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
/* defined for backward compatibility */
#define cdPutImageRGB(iw, ih, r, g, b, x, y, w, h) cdPutImageRectRGB((iw), (ih), (r), (g), (b), (x), (y), (w), (h), 0, 0, 0, 0)
#define cdPutImageRGBA(iw, ih, r, g, b, a, x, y, w, h) cdPutImageRectRGBA((iw), (ih), (r), (g), (b), (a), (x), (y), (w), (h), 0, 0, 0, 0)
#define cdPutImageMap(iw, ih, index, colors, x, y, w, h) cdPutImageRectMap((iw), (ih), (index), (colors), (x), (y), (w), (h), 0, 0, 0, 0)
#define cdPutImage(image, x, y) cdPutImageRect((image), (x), (y), 0, 0, 0, 0)
/* server images */
cdImage* cdCreateImage(int w, int h);
void cdGetImage(cdImage* image, int x, int y);
void cdPutImageRect(cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
void cdScrollArea(int xmin, int xmax, int ymin, int ymax, int dx, int dy);
/* bitmap */
void cdPutBitmap(cdBitmap* bitmap, int x, int y, int w, int h);
void cdGetBitmap(cdBitmap* bitmap, int x, int y);
enum { /* OLD type face -> new names */
CD_SYSTEM, /* "System" */
CD_COURIER, /* "Courier" */
CD_TIMES_ROMAN, /* "Times" */
CD_HELVETICA, /* "Helvetica" */
CD_NATIVE
};
/* OLD definitions, defined for backward compatibility */
#define CD_CLIPON CD_CLIPAREA
#define CD_CENTER_BASE CD_BASE_CENTER
#define CD_LEFT_BASE CD_BASE_LEFT
#define CD_RIGHT_BASE CD_BASE_RIGHT
#define CD_ITALIC_BOLD CD_BOLD_ITALIC
#define cdScrollImage cdScrollArea
#define cdCanvas2Raster(x, y) {(void)x; cdUpdateYAxis(y);}
#ifdef __cplusplus
}
#endif
#endif
-634
View File
@@ -1,634 +0,0 @@
/** \file
* \brief Name space for C++ high level API
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PLUS_H
#define __CD_PLUS_H
#include "cd.h"
#include "wd.h"
#include "cdiup.h"
#include "cddbuf.h"
#include "cdprint.h"
#include "cdnative.h"
#include "cdgdiplus.h"
#include "cdcgm.h"
#include "cddgn.h"
#include "cddxf.h"
#include "cdclipbd.h"
#include "cdemf.h"
#include "cdirgb.h"
#include "cdmf.h"
#include "cdps.h"
#include "cdpdf.h"
#include "cdsvg.h"
#include "cdwmf.h"
#include "cddebug.h"
#include "cdgl.h"
#include "cdpicture.h"
#include "cdim.h"
/** \brief Name space for C++ high level API
*
* \par
* Defines wrapper classes for all C structures.
*
* See \ref cd_plus.h
*/
namespace cd
{
inline char* Version() { return cdVersion(); }
inline char* VersionDate() { return cdVersionDate(); }
inline int VersionNumber() { return cdVersionNumber(); }
inline long ColorEncode(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255) {
return cdEncodeColorAlpha(red, green, blue, alpha); }
inline unsigned char ColorAlpha(long color) { return cdAlpha(color); }
inline unsigned char ColorRed(long color) { return cdRed(color); }
inline unsigned char ColorGreen(long color) { return cdGreen(color); }
inline unsigned char ColorBlue(long color) { return cdBlue(color); }
class Context
{
cdContext* cd_context;
friend class Canvas;
public:
Context(cdContext* ref_context) { cd_context = ref_context; }
unsigned long Caps() { return cdContextCaps(cd_context); }
bool IsPlus() { return cdContextIsPlus(cd_context) != 0; }
int Type() { return cdContextType(cd_context); }
static void UsePlus(bool use) { cdUseContextPlus(use); }
static void InitPlus() { cdInitContextPlus(); }
static void FinishPlus() { cdFinishContextPlus(); }
static void GetScreenSize(int &width, int &height, double &width_mm, double &height_mm) { cdGetScreenSize(&width, &height, &width_mm, &height_mm); }
static int GetScreenColorPlanes() { return cdGetScreenColorPlanes(); }
};
class Canvas
{
/* forbidden */
Canvas(const Canvas&) {}
protected:
cdCanvas* canvas;
bool release;
Canvas() { canvas = 0; release = true; }
static inline int PlaySize_CB(cdCanvas *cd_canvas, int w, int h, double w_mm, double h_mm) {
Canvas* canvas = (Canvas*)cdCanvasGetAttribute(cd_canvas, "USERDATA");
return canvas->PlaySizeCallback(w, h, w_mm, h_mm);
}
public:
Canvas(cdCanvas* ref_canvas) { canvas = ref_canvas; release = false; }
virtual ~Canvas() {
if (canvas && release)
cdKillCanvas(canvas);
}
cdCanvas* GetHandle() const { return canvas; }
bool Failed() const {
return canvas == 0;
}
Context GetContext() { return cdCanvasGetContext(canvas); }
int Activate() { return cdCanvasActivate(canvas); }
void Deactivate() { cdCanvasDeactivate(canvas); }
/* control */
int Simulate(int mode) { return cdCanvasSimulate(canvas, mode); }
void Flush() { cdCanvasFlush(canvas); }
void Clear() { cdCanvasClear(canvas); }
cdState* SaveState() { return cdCanvasSaveState(canvas); }
void RestoreState(cdState* state) { cdCanvasRestoreState(canvas, state); }
void ReleaseState(cdState* state) { cdReleaseState(state); }
void SetAttribute(const char* name, char* data) { cdCanvasSetAttribute(canvas, name, data); }
char* GetAttribute(const char* name) { return cdCanvasGetAttribute(canvas, name); }
virtual int PlaySizeCallback(int /* w */, int /* h */, double /* w_mm */, double /* h_mm */) { return CD_CONTINUE; }
/* interpretation */
int Play(const Context& context, int xmin, int xmax, int ymin, int ymax, void *data) {
cdCanvasSetAttribute(canvas, "USERDATA", (char*)this);
cdContextRegisterCallback(context.cd_context, CD_SIZECB, (cdCallback)PlaySize_CB);
return cdCanvasPlay(canvas, context.cd_context, xmin, xmax, ymin, ymax, data);
}
int wPlay(const Context& context, double xmin, double xmax, double ymin, double ymax, void *data) {
cdCanvasSetAttribute(canvas, "USERDATA", (char*)this);
cdContextRegisterCallback(context.cd_context, CD_SIZECB, (cdCallback)PlaySize_CB);
return wdCanvasPlay(canvas, context.cd_context, xmin, xmax, ymin, ymax, data);
}
/* coordinates utilities */
void GetSize(int &width, int &height, double &width_mm, double &height_mm) { cdCanvasGetSize(canvas, &width, &height, &width_mm, &height_mm); }
int UpdateYAxis(int &y) { return cdCanvasUpdateYAxis(canvas, &y); }
double UpdateYAxis(double &y) { return cdfCanvasUpdateYAxis(canvas, &y); }
int InvertYAxis(int y) { return cdCanvasInvertYAxis(canvas, y); }
double InvertYAxis(double y) { return cdfCanvasInvertYAxis(canvas, y); }
void MM2Pixel(double mm_dx, double mm_dy, int &dx, int &dy) { cdCanvasMM2Pixel(canvas, mm_dx, mm_dy, &dx, &dy); }
void MM2Pixel(double mm_dx, double mm_dy, double &dx, double &dy) { cdfCanvasMM2Pixel(canvas, mm_dx, mm_dy, &dx, &dy); }
void Pixel2MM(int dx, int dy, double &mm_dx, double &mm_dy) { cdCanvasPixel2MM(canvas, dx, dy, &mm_dx, &mm_dy); }
void Pixel2MM(double dx, double dy, double &mm_dx, double &mm_dy) { cdfCanvasPixel2MM(canvas, dx, dy, &mm_dx, &mm_dy); }
void Origin(int x, int y) { cdCanvasOrigin(canvas, x, y); }
void Origin(double x, double y) { cdfCanvasOrigin(canvas, x, y); }
void GetOrigin(int &x, int &y) { cdCanvasGetOrigin(canvas, &x, &y); }
void GetOrigin(double &x, double &y) { cdfCanvasGetOrigin(canvas, &x, &y); }
/* coordinates transformation */
void Transform(const double* matrix) { cdCanvasTransform(canvas, matrix); }
double* GetTransform() { return cdCanvasGetTransform(canvas); }
void TransformMultiply(const double* matrix) { cdCanvasTransformMultiply(canvas, matrix); }
void TransformRotate(double angle) { cdCanvasTransformRotate(canvas, angle); }
void TransformScale(double sx, double sy) { cdCanvasTransformScale(canvas, sx, sy); }
void TransformTranslate(double dx, double dy) { cdCanvasTransformTranslate(canvas, dx, dy); }
void TransformPoint(int x, int y, int &tx, int &ty) { cdCanvasTransformPoint(canvas, x, y, &tx, &ty); }
void TransformPoint(double x, double y, double &tx, double &ty) { cdfCanvasTransformPoint(canvas, x, y, &tx, &ty); }
/* world coordinate transformation */
void wWindow(double xmin, double xmax, double ymin, double ymax) { wdCanvasWindow(canvas, xmin, xmax, ymin, ymax); }
void wGetWindow(double &xmin, double &xmax, double &ymin, double &ymax) { wdCanvasGetWindow(canvas, &xmin, &xmax, &ymin, &ymax); }
void wViewport(int xmin, int xmax, int ymin, int ymax) { wdCanvasViewport(canvas, xmin, xmax, ymin, ymax); }
void wGetViewport(int &xmin, int &xmax, int &ymin, int &ymax) { wdCanvasGetViewport(canvas, &xmin, &xmax, &ymin, &ymax); }
void wWorld2Canvas(double xw, double yw, int &xv, int &yv) { wdCanvasWorld2Canvas(canvas, xw, yw, &xv, &yv); }
void wWorld2CanvasSize(double hw, double vw, int &hv, int &vv) { wdCanvasWorld2CanvasSize(canvas, hw, vw, &hv, &vv); }
void wCanvas2World(int xv, int yv, double &xw, double &yw) { wdCanvasCanvas2World(canvas, xv, yv, &xw, &yw); }
void wSetTransform(double sx, double sy, double tx, double ty) { wdCanvasSetTransform(canvas, sx, sy, tx, ty); }
void wGetTransform(double &sx, double &sy, double &tx, double &ty) { wdCanvasGetTransform(canvas, &sx, &sy, &tx, &ty); }
void wTranslate(double dtx, double dty) { wdCanvasTranslate(canvas, dtx, dty); }
void wScale(double dsx, double dsy) { wdCanvasScale(canvas, dsx, dsy); }
/* clipping */
int Clip(int mode) { return cdCanvasClip(canvas, mode); }
void ClipArea(int xmin, int xmax, int ymin, int ymax) { cdCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
void ClipArea(double xmin, double xmax, double ymin, double ymax) { cdfCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
void wClipArea(double xmin, double xmax, double ymin, double ymax) { wdCanvasClipArea(canvas, xmin, xmax, ymin, ymax); }
int GetClipArea(int &xmin, int &xmax, int &ymin, int &ymax) { return cdCanvasGetClipArea(canvas, &xmin, &xmax, &ymin, &ymax); }
int GetClipArea(double &xmin, double &xmax, double &ymin, double &ymax) { return cdfCanvasGetClipArea(canvas, &xmin, &xmax, &ymin, &ymax); }
int wGetClipArea(double &xmin, double &xmax, double &ymin, double &ymax) { return wdCanvasGetClipArea(canvas, &xmin, &xmax, &ymin, &ymax); }
/* clipping region */
int IsPointInRegion(int x, int y) { return cdCanvasIsPointInRegion(canvas, x, y); }
int wIsPointInRegion(double x, double y) { return wdCanvasIsPointInRegion(canvas, x, y); }
void OffsetRegion(int x, int y) { cdCanvasOffsetRegion(canvas, x, y); }
void wOffsetRegion(double x, double y) { wdCanvasOffsetRegion(canvas, x, y); }
void GetRegionBox(int &xmin, int &xmax, int &ymin, int &ymax) { cdCanvasGetRegionBox(canvas, &xmin, &xmax, &ymin, &ymax); }
void wGetRegionBox(double &xmin, double &xmax, double &ymin, double &ymax) { wdCanvasGetRegionBox(canvas, &xmin, &xmax, &ymin, &ymax); }
int RegionCombineMode(int mode) { return cdCanvasRegionCombineMode(canvas, mode); }
/* primitives */
void Pixel(int x, int y, long color) { cdCanvasPixel(canvas, x, y, color); }
void Pixel(double x, double y, long color) { cdfCanvasPixel(canvas, x, y, color); }
void wPixel(double x, double y, long color) { wdCanvasPixel(canvas, x, y, color); }
void Mark(int x, int y) { cdCanvasMark(canvas, x, y); }
void Mark(double x, double y) { cdfCanvasMark(canvas, x, y); }
void wMark(double x, double y) { wdCanvasMark(canvas, x, y); }
void Begin(int mode) { cdCanvasBegin(canvas, mode); }
void PathSet(int action) { cdCanvasPathSet(canvas, action); }
void End() { cdCanvasEnd(canvas); }
void Line(int x1, int y1, int x2, int y2) { cdCanvasLine(canvas, x1, y1, x2, y2); }
void Line(double x1, double y1, double x2, double y2) { cdfCanvasLine(canvas, x1, y1, x2, y2); }
void wLine(double x1, double y1, double x2, double y2) { wdCanvasLine(canvas, x1, y1, x2, y2); }
void Vertex(int x, int y) { cdCanvasVertex(canvas, x, y); }
void wVertex(double x, double y) { wdCanvasVertex(canvas, x, y); }
void Vertex(double x, double y) { cdfCanvasVertex(canvas, x, y); }
void Rect(int xmin, int xmax, int ymin, int ymax) { cdCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void Rect(double xmin, double xmax, double ymin, double ymax) { cdfCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void wRect(double xmin, double xmax, double ymin, double ymax) { wdCanvasRect(canvas, xmin, xmax, ymin, ymax); }
void Box(int xmin, int xmax, int ymin, int ymax) { cdCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void Box(double xmin, double xmax, double ymin, double ymax) { cdfCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void wBox(double xmin, double xmax, double ymin, double ymax) { wdCanvasBox(canvas, xmin, xmax, ymin, ymax); }
void Arc(int xc, int yc, int w, int h, double angle1, double angle2) { cdCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void Arc(double xc, double yc, double w, double h, double angle1, double angle2) { cdfCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void wArc(double xc, double yc, double w, double h, double angle1, double angle2) { wdCanvasArc(canvas, xc, yc, w, h, angle1, angle2); }
void Sector(int xc, int yc, int w, int h, double angle1, double angle2) { cdCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void Sector(double xc, double yc, double w, double h, double angle1, double angle2) { cdfCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void wSector(double xc, double yc, double w, double h, double angle1, double angle2) { wdCanvasSector(canvas, xc, yc, w, h, angle1, angle2); }
void Chord(double xc, double yc, double w, double h, double angle1, double angle2) { cdfCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void Chord(int xc, int yc, int w, int h, double angle1, double angle2) { cdCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void wChord(double xc, double yc, double w, double h, double angle1, double angle2) { wdCanvasChord(canvas, xc, yc, w, h, angle1, angle2); }
void Text(int x, int y, const char* s) { cdCanvasText(canvas, x, y, s); }
void Text(double x, double y, const char* s) { cdfCanvasText(canvas, x, y, s); }
void wText(double x, double y, const char* s) { wdCanvasText(canvas, x, y, s); }
/* attributes */
void SetBackground(long color) { cdCanvasSetBackground(canvas, color); }
void SeForeground(long color) { cdCanvasSetForeground(canvas, color); }
long Background(long color) { return cdCanvasBackground(canvas, color); }
long Foreground(long color) { return cdCanvasForeground(canvas, color); }
int BackOpacity(int opacity) { return cdCanvasBackOpacity(canvas, opacity); }
int WriteMode(int mode) { return cdCanvasWriteMode(canvas, mode); }
int LineStyle(int style) { return cdCanvasLineStyle(canvas, style); }
void LineStyleDashes(const int* dashes, int count) { cdCanvasLineStyleDashes(canvas, dashes, count); }
int LineWidth(int width) { return cdCanvasLineWidth(canvas, width); }
double wLineWidth(double width) { return wdCanvasLineWidth(canvas, width); }
int LineJoin(int join) { return cdCanvasLineJoin(canvas, join); }
int LineCap(int cap) { return cdCanvasLineCap(canvas, cap); }
int InteriorStyle(int style) { return cdCanvasInteriorStyle(canvas, style); }
int Hatch(int style) { return cdCanvasHatch(canvas, style); }
#ifdef __IM_PLUS_H
void Stipple(const im::Image& stipple) { cdCanvasStippleImImage(canvas, stipple.GetHandle()); }
unsigned char* GetStipple(int &n, int &m) { return cdCanvasGetStipple(canvas, &n, &m); }
void Pattern(const im::Image& pattern) { cdCanvasPatternImImage(canvas, pattern.GetHandle()); }
long* GetPattern(int& n, int& m) { return cdCanvasGetPattern(canvas, &n, &m); }
#endif
int FillMode(int mode) { return cdCanvasFillMode(canvas, mode); }
int Font(const char* type_face, int style, int size) { return cdCanvasFont(canvas, type_face, style, size); }
int wFont(const char* type_face, int style, double size) { return wdCanvasFont(canvas, type_face, style, size); }
void GetFont(char *type_face, int &style, int &size) { cdCanvasGetFont(canvas, type_face, &style, &size); }
void wGetFont(char *type_face, int &style, double &size) { wdCanvasGetFont(canvas, type_face, &style, &size); }
char* NativeFont(const char* font) { return cdCanvasNativeFont(canvas, font); }
int TextAlignment(int alignment) { return cdCanvasTextAlignment(canvas, alignment); }
double TextOrientation(double angle) { return cdCanvasTextOrientation(canvas, angle); }
int MarkType(int type) { return cdCanvasMarkType(canvas, type); }
int MarkSize(int size) { return cdCanvasMarkSize(canvas, size); }
double wMarkSize(double size) { return wdCanvasMarkSize(canvas, size); }
/* vector text */
void VectorText(int x, int y, const char* s) { cdCanvasVectorText(canvas, x, y, s); }
void VectorText(double x, double y, const char* s) { cdfCanvasVectorText(canvas, x, y, s); }
void wVectorText(double x, double y, const char* s) { wdCanvasVectorText(canvas, x, y, s); }
void MultiLineVectorText(int x, int y, const char* s) { cdCanvasMultiLineVectorText(canvas, x, y, s); }
void MultiLineVectorText(double x, double y, const char* s) { cdfCanvasMultiLineVectorText(canvas, x, y, s); }
void wMultiLineVectorText(double x, double y, const char* s) { wdCanvasMultiLineVectorText(canvas, x, y, s); }
/* vector text attributes */
char *VectorFont(const char *filename) { return cdCanvasVectorFont(canvas, filename); }
void VectorTextDirection(int x1, int y1, int x2, int y2) { cdCanvasVectorTextDirection(canvas, x1, y1, x2, y2); }
void VectorTextDirection(double x1, double y1, double x2, double y2) { cdfCanvasVectorTextDirection(canvas, x1, y1, x2, y2); }
void wVectorTextDirection(double x1, double y1, double x2, double y2) { wdCanvasVectorTextDirection(canvas, x1, y1, x2, y2); }
double* VectorTextTransform(const double* matrix) { return cdCanvasVectorTextTransform(canvas, matrix); }
void VectorTextSize(int size_x, int size_y, const char* s) { cdCanvasVectorTextSize(canvas, size_x, size_y, s); }
void VectorTextSize(double size_x, double size_y, const char* s) { cdfCanvasVectorTextSize(canvas, size_x, size_y, s); }
void wVectorTextSize(double size_x, double size_y, const char* s) { wdCanvasVectorTextSize(canvas, size_x, size_y, s); }
int VectorCharSize(int size) { return cdCanvasVectorCharSize(canvas, size); }
double VectorCharSize(double size) { return cdfCanvasVectorCharSize(canvas, size); }
double wVectorCharSize(double size) { return wdCanvasVectorCharSize(canvas, size); }
void VectorFontSize(double size_x, double size_y) { cdCanvasVectorFontSize(canvas, size_x, size_y); }
void GetVectorFontSize(double &size_x, double &size_y) { cdCanvasGetVectorFontSize(canvas, &size_x, &size_y); }
/* vector text properties */
void GetVectorTextSize(const char* s, int &x, int &y) { cdCanvasGetVectorTextSize(canvas, s, &x, &y); }
void GetVectorTextSize(const char* s, double &x, double &y) { cdfCanvasGetVectorTextSize(canvas, s, &x, &y); }
void wGetVectorTextSize(const char* s, double &x, double &y) { wdCanvasGetVectorTextSize(canvas, s, &x, &y); }
void GetVectorTextBounds(const char* s, int x, int y, int *rect) { cdCanvasGetVectorTextBounds(canvas, s, x, y, rect); }
void GetVectorTextBounds(const char* s, double x, double y, double *rect) { cdfCanvasGetVectorTextBounds(canvas, s, x, y, rect); }
void wGetVectorTextBounds(const char* s, double x, double y, double *rect) { wdCanvasGetVectorTextBounds(canvas, s, x, y, rect); }
void GetVectorTextBox(int x, int y, const char *s, int &xmin, int &xmax, int &ymin, int &ymax) { cdCanvasGetVectorTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
void GetVectorTextBox(double x, double y, const char *s, double &xmin, double &xmax, double &ymin, double &ymax) { cdfCanvasGetVectorTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
void wGetVectorTextBox(double x, double y, const char *s, double &xmin, double &xmax, double &ymin, double &ymax) { wdCanvasGetVectorTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
/* properties */
void GetFontDim(int &max_width, int &height, int &ascent, int &descent) { cdCanvasGetFontDim(canvas, &max_width, &height, &ascent, &descent); }
void wGetFontDim(double &max_width, double &height, double &ascent, double &descent) { wdCanvasGetFontDim(canvas, &max_width, &height, &ascent, &descent); }
void GetTextSize(const char* s, int &width, int &height) { cdCanvasGetTextSize(canvas, s, &width, &height); }
void wGetTextSize(const char* s, double &width, double &height) { wdCanvasGetTextSize(canvas, s, &width, &height); }
void GetTextBox(int x, int y, const char* s, int &xmin, int &xmax, int &ymin, int &ymax) { cdCanvasGetTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
void GetTextBox(double x, double y, const char* s, double &xmin, double &xmax, double &ymin, double &ymax) { cdfCanvasGetTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
void wGetTextBox(double x, double y, const char* s, double &xmin, double &xmax, double &ymin, double &ymax) { wdCanvasGetTextBox(canvas, x, y, s, &xmin, &xmax, &ymin, &ymax); }
void GetTextBounds(int x, int y, const char* s, int *rect) { cdCanvasGetTextBounds(canvas, x, y, s, rect); }
void GetTextBounds(double x, double y, const char* s, double *rect) { cdfCanvasGetTextBounds(canvas, x, y, s, rect); }
void wGetTextBounds(double x, double y, const char* s, double *rect) { wdCanvasGetTextBounds(canvas, x, y, s, rect); }
int GetColorPlanes() { return cdCanvasGetColorPlanes(canvas); }
/* client images */
#ifdef __IM_PLUS_H
void PutImage(const im::Image& image, int x, int y, int w, int h) { cdCanvasPutImImage(canvas, image.GetHandle(), x, y, w, h); }
void PutImage(const im::Image& image, double x, double y, double w, double h) { cdfCanvasPutImImage(canvas, image.GetHandle(), x, y, w, h); }
void wPutImage(const im::Image& image, double x, double y, double w, double h) { wdCanvasPutImImage(canvas, image.GetHandle(), x, y, w, h); }
void GetImage(im::Image& image, int x, int y) { cdCanvasGetImImage(canvas, image.GetHandle(), x, y); }
void wGetImage(im::Image& image, double x, double y) { wdCanvasGetImImage(canvas, image.GetHandle(), x, y); }
#endif
};
class CanvasImageRGB : public Canvas
{
public:
CanvasImageRGB(int width, int height, bool has_alpha = false, double res = 0)
: Canvas() { const char *alpha = "";
if (has_alpha)
alpha = "-a";
if (res)
canvas = cdCreateCanvasf(CD_IMAGERGB, "%dx%d %g %s", width, height, res, alpha);
else
canvas = cdCreateCanvasf(CD_IMAGERGB, "%dx%d %s", width, height, alpha); }
};
#ifdef __IM_PLUS_H
class CanvasImImage : public Canvas
{
public:
CanvasImImage(im::Image& image, double res = 0)
: Canvas() { canvas = cdCreateCanvas(CD_IMIMAGE, image.GetHandle());
if (canvas && res)
cdCanvasSetfAttribute(canvas, "RESOLUTION", "%g", res);
}
};
#endif
class CanvasMetafileEMF : public Canvas
{
public:
CanvasMetafileEMF(const char* filename, int width, int height, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_EMF, "\"%s\" %dx%d %g", filename, width, height, res);
else
canvas = cdCreateCanvasf(CD_EMF, "\"%s\" %dx%d", filename, width, height);
}
};
class CanvasMetafileWMF : public Canvas
{
public:
CanvasMetafileWMF(const char* filename, int width, int height, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_WMF, "\"%s\" %dx%d %g", filename, width, height, res);
else
canvas = cdCreateCanvasf(CD_WMF, "\"%s\" %dx%d", filename, width, height);
}
};
class CanvasMetafileMF : public Canvas
{
public:
CanvasMetafileMF(const char* filename, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_METAFILE, "\"%s\" %g", filename, res);
else
canvas = cdCreateCanvasf(CD_METAFILE, "\"%s\"", filename);
}
CanvasMetafileMF(const char* filename, double width_mm, double height_mm, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_METAFILE, "\"%s\" %gx%g %g", filename, width_mm, height_mm, res);
else
canvas = cdCreateCanvasf(CD_METAFILE, "\"%s\" %gx%g", filename, width_mm, height_mm);
}
};
class CanvasMetafileSVG : public Canvas
{
public:
CanvasMetafileSVG(const char* filename, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_SVG, "\"%s\" %g", filename, res);
else
canvas = cdCreateCanvasf(CD_SVG, "\"%s\"", filename);
}
CanvasMetafileSVG(const char* filename, double width_mm, double height_mm, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_SVG, "\"%s\" %gx%g %g", filename, width_mm, height_mm, res);
else
canvas = cdCreateCanvasf(CD_SVG, "\"%s\" %gx%g", filename, width_mm, height_mm);
}
};
class CanvasMetafileDebug : public Canvas
{
public:
CanvasMetafileDebug(const char* filename, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_DEBUG, "\"%s\" %g", filename, res);
else
canvas = cdCreateCanvasf(CD_DEBUG, "\"%s\"", filename);
}
CanvasMetafileDebug(const char* filename, double width_mm, double height_mm, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_DEBUG, "\"%s\" %gx%g %g", filename, width_mm, height_mm, res);
else
canvas = cdCreateCanvasf(CD_DEBUG, "\"%s\" %gx%g", filename, width_mm, height_mm);
}
};
class CanvasPrinter : public Canvas
{
public:
CanvasPrinter(const char* name, bool show_dialog = false)
: Canvas() { if (show_dialog)
canvas = cdCreateCanvasf(CD_PRINTER, "%s -d", name);
else
canvas = cdCreateCanvasf(CD_PRINTER, "%s", name);
}
};
class CanvasOpenGL : public Canvas
{
public:
CanvasOpenGL(int width, int height, double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_GL, "%dx%d %g", width, height, res);
else
canvas = cdCreateCanvasf(CD_GL, "%dx%d", width, height);
}
};
class CanvasPicture : public Canvas
{
public:
CanvasPicture(double res = 0)
: Canvas() { if (res)
canvas = cdCreateCanvasf(CD_PICTURE, "%g", res);
else
canvas = cdCreateCanvas(CD_PICTURE, "");
}
};
class CanvasMetafileDGN : public Canvas
{
public:
CanvasMetafileDGN(const char* filename, double res = 0, bool polygon_filling = true, const char* seed_file = 0)
: Canvas() { char* polygon_filling_str = "";
if (!polygon_filling)
polygon_filling_str = "-f";
char* seed_file_str = "";
if (seed_file)
seed_file_str = "-s";
else
seed_file = "";
if (res)
canvas = cdCreateCanvasf(CD_DGN, "\"%s\" %g %s %s%s", filename, res, polygon_filling_str, seed_file_str, seed_file);
else
canvas = cdCreateCanvasf(CD_DGN, "\"%s\" %s %s%s", filename, polygon_filling_str, seed_file_str, seed_file);
}
CanvasMetafileDGN(const char* filename, double width_mm, double height_mm, double res = 0, bool polygon_filling = true, const char* seed_file = 0)
: Canvas() { char* polygon_filling_str = "";
if (!polygon_filling)
polygon_filling_str = "-f";
char* seed_file_str = "";
if (seed_file)
seed_file_str = "-s";
else
seed_file = "";
if (res)
canvas = cdCreateCanvasf(CD_DGN, "\"%s\" %gx%g %g %s %s%s", filename, width_mm, height_mm, res, polygon_filling_str, seed_file_str, seed_file);
else
canvas = cdCreateCanvasf(CD_DGN, "\"%s\" %gx%g %s %s%s", filename, width_mm, height_mm, polygon_filling_str, seed_file_str, seed_file);
}
};
class CanvasMetafileDXF : public Canvas
{
public:
CanvasMetafileDXF(const char* filename, double res = 0, bool acad2000 = true, double xmin = 0, double ymin = 0, double xmax = 0, double ymax = 0)
: Canvas() { char* acad2000_str = "";
if (acad2000)
acad2000_str = "-ac2000";
if (xmin || ymin || xmax || ymax)
{ if (res)
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %g %s -limits %g %g %g %g", filename, res, acad2000_str, xmin, ymin, xmax, ymax);
else
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %s -limits %g %g %g %g", filename, acad2000_str, xmin, ymin, xmax, ymax);
}
else
{ if (res)
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %g %s", filename, res, acad2000_str);
else
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %s", filename, acad2000_str);
}
}
CanvasMetafileDXF(const char* filename, double width_mm, double height_mm, double res = 0, bool acad2000 = true, double xmin = 0, double ymin = 0, double xmax = 0, double ymax = 0)
: Canvas() { char* acad2000_str = "";
if (acad2000)
acad2000_str = "-ac2000";
if (xmin || ymin || xmax || ymax)
{ if (res)
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %gx%g %g %s -limits %g %g %g %g", filename, width_mm, height_mm, res, acad2000_str, xmin, ymin, xmax, ymax);
else
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %gx%g %s -limits %g %g %g %g", filename, width_mm, height_mm, acad2000_str, xmin, ymin, xmax, ymax);
}
else
{ if (res)
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %gx%g %g %s %s%s", filename, width_mm, height_mm, res, acad2000_str);
else
canvas = cdCreateCanvasf(CD_DXF, "\"%s\" %gx%g %s %s%s", filename, width_mm, height_mm, acad2000_str);
}
}
};
class CanvasMetafileCGM : public Canvas
{
public:
CanvasMetafileCGM(const char* filename, double res = 0, bool text_encoding = false, const char* precision = 0, const char* description = 0)
: Canvas() { char* text_encoding_str = "";
if (text_encoding)
text_encoding_str = "-d";
if (!precision) /* can be "16" (short), "32" (int), "F" (float), "D" (double) */
precision = "16";
char* description_str = "";
if (description)
description_str = "-s";
else
description = "";
if (res)
canvas = cdCreateCanvasf(CD_CGM, "\"%s\" %g %s -p%s %s%s", filename, res, text_encoding_str, precision, description_str, description);
else
canvas = cdCreateCanvasf(CD_CGM, "\"%s\" %s -p%s %s%s", filename, text_encoding_str, precision, description_str, description);
}
CanvasMetafileCGM(const char* filename, double width_mm, double height_mm, double res = 0, bool text_encoding = false, const char* precision = 0, const char* description = 0)
: Canvas() { char* text_encoding_str = "";
if (text_encoding)
text_encoding_str = "-t";
if (!precision) /* can be "16" (short), "32" (int), "F" (float), "D" (double) */
precision = "16";
char* description_str = "";
if (description)
description_str = "-d";
else
description = "";
if (res)
canvas = cdCreateCanvasf(CD_CGM, "\"%s\" %gx%g %g %s -p%s %s%s", filename, width_mm, height_mm, res, text_encoding_str, precision, description_str, description);
else
canvas = cdCreateCanvasf(CD_CGM, "\"%s\" %gx%g %s -p%s %s%s", filename, width_mm, height_mm, text_encoding_str, precision, description_str, description);
}
};
class CanvasMetafilePDF : public Canvas
{
public:
CanvasMetafilePDF(const char* filename, int paper, int res_dpi = 0, bool landscape = false)
: Canvas() { char* landscape_str = "";
if (landscape)
landscape_str = "-o";
char* res_dpi_str = "";
if (res_dpi)
res_dpi_str = "-s";
canvas = cdCreateCanvasf(CD_PDF, "\"%s\" -p%d %s%s %s", filename, paper, res_dpi_str, res_dpi, landscape_str);
}
CanvasMetafilePDF(const char* filename, double width_mm, double height_mm, int res_dpi = 0, bool landscape = false)
: Canvas() { char* landscape_str = "";
if (landscape)
landscape_str = "-o";
char* res_dpi_str = "";
if (res_dpi)
res_dpi_str = "-s";
canvas = cdCreateCanvasf(CD_PDF, "\"%s\" -w%g -h%g %s%s %s", filename, width_mm, height_mm, res_dpi_str, res_dpi, landscape_str);
}
};
class CanvasMetafilePS : public Canvas
{
public:
CanvasMetafilePS(const char* filename, int paper, int res_dpi = 0, bool landscape = false)
: Canvas() { char* landscape_str = "";
if (landscape)
landscape_str = "-o";
char* res_dpi_str = "";
if (res_dpi)
res_dpi_str = "-s";
canvas = cdCreateCanvasf(CD_PS, "\"%s\" -p%d %s%s %s", filename, paper, res_dpi_str, res_dpi, landscape_str);
}
CanvasMetafilePS(const char* filename, double width_mm, double height_mm, int res_dpi = 0, bool landscape = false)
: Canvas() { char* landscape_str = "";
if (landscape)
landscape_str = "-o";
char* res_dpi_str = "";
if (res_dpi)
res_dpi_str = "-s";
canvas = cdCreateCanvasf(CD_PS, "\"%s\" -w%g -h%g %s%s %s", filename, width_mm, height_mm, res_dpi_str, res_dpi, landscape_str);
}
CanvasMetafilePS(const char* filename, int res_dpi = 0, bool landscape = false)
: Canvas() { char* landscape_str = "";
if (landscape)
landscape_str = "-o";
char* res_dpi_str = "";
if (res_dpi)
res_dpi_str = "-s";
canvas = cdCreateCanvasf(CD_PS, "\"%s\" -e %s%s %s", filename, res_dpi_str, res_dpi, landscape_str);
}
};
}
#endif
-440
View File
@@ -1,440 +0,0 @@
/** \file
* \brief Private CD declarations
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PRIVATE_H
#define __CD_PRIVATE_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/* All context canvas must have at least the base canvas pointer. */
typedef struct _cdCtxCanvasBase
{
cdCanvas* canvas;
} cdCtxCanvasBase;
typedef struct _cdCtxCanvas cdCtxCanvas;
typedef struct _cdCtxImage cdCtxImage;
typedef struct _cdVectorFont cdVectorFont;
typedef struct _cdSimulation cdSimulation;
typedef struct _cdPoint
{
int x, y;
} cdPoint;
typedef struct _cdfPoint
{
double x, y;
} cdfPoint;
typedef struct _cdRect
{
int xmin, xmax, ymin, ymax;
} cdRect;
typedef struct _cdfRect
{
double xmin, xmax, ymin, ymax;
} cdfRect;
typedef struct _cdAttribute
{
const char *name;
/* can be NULL one of them */
void (*set)(cdCtxCanvas* ctxcanvas, char* data);
char* (*get)(cdCtxCanvas* ctxcanvas);
} cdAttribute;
struct _cdImage
{
int w, h;
cdCtxImage* ctximage;
/* can NOT be NULL */
void (*cxGetImage)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y);
void (*cxPutImageRect)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y, int xmin, int xmax, int ymin, int ymax);
void (*cxKillImage)(cdCtxImage* ctximage);
};
struct _cdContext
{
unsigned long caps; /* canvas capabilities, combination of CD_CAP_* */
int type; /* context type WINDOW, DEVICE, IMAGE or FILE, combined with PLUS */
/* can NOT be NULL */
void (*cxCreateCanvas)(cdCanvas* canvas, void *data);
void (*cxInitTable)(cdCanvas* canvas);
/* can be NULL */
int (*cxPlay)(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, void *data);
int (*cxRegisterCallback)(int cb, cdCallback func);
};
struct _cdCanvas
{
char signature[2]; /* must be "CD" */
/* can NOT be NULL */
void (*cxPixel)(cdCtxCanvas* ctxcanvas, int x, int y, long color);
void (*cxLine)(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2);
void (*cxPoly)(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int n);
void (*cxRect)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxBox)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxArc)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxSector)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxChord)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxText)(cdCtxCanvas* ctxcanvas, int x, int y, const char *s, int len);
void (*cxKillCanvas)(cdCtxCanvas* ctxcanvas);
int (*cxFont)(cdCtxCanvas* ctxcanvas, const char *type_face, int style, int size);
void (*cxPutImageRectMap)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char *index, const long *colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
/* default implementation uses the simulation driver */
void (*cxGetFontDim)(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent);
void (*cxGetTextSize)(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height);
/* all the following function pointers can be NULL */
void (*cxFlush)(cdCtxCanvas* ctxcanvas);
void (*cxClear)(cdCtxCanvas* ctxcanvas);
void (*cxFPixel)(cdCtxCanvas* ctxcanvas, double x, double y, long color);
void (*cxFLine)(cdCtxCanvas* ctxcanvas, double x1, double y1, double x2, double y2);
void (*cxFPoly)(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* points, int n);
void (*cxFRect)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
void (*cxFBox)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
void (*cxFArc)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFSector)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFChord)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFText)(cdCtxCanvas* ctxcanvas, double x, double y, const char *s, int len);
int (*cxClip)(cdCtxCanvas* ctxcanvas, int mode);
void (*cxClipArea)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxFClipArea)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
int (*cxBackOpacity)(cdCtxCanvas* ctxcanvas, int opacity);
int (*cxWriteMode)(cdCtxCanvas* ctxcanvas, int mode);
int (*cxLineStyle)(cdCtxCanvas* ctxcanvas, int style);
int (*cxLineWidth)(cdCtxCanvas* ctxcanvas, int width);
int (*cxLineJoin)(cdCtxCanvas* ctxcanvas, int join);
int (*cxLineCap)(cdCtxCanvas* ctxcanvas, int cap);
int (*cxInteriorStyle)(cdCtxCanvas* ctxcanvas, int style);
int (*cxHatch)(cdCtxCanvas* ctxcanvas, int style);
void (*cxStipple)(cdCtxCanvas* ctxcanvas, int w, int h, const unsigned char *stipple);
void (*cxPattern)(cdCtxCanvas* ctxcanvas, int w, int h, const long *pattern);
int (*cxNativeFont)(cdCtxCanvas* ctxcanvas, const char* font);
int (*cxTextAlignment)(cdCtxCanvas* ctxcanvas, int alignment);
double (*cxTextOrientation)(cdCtxCanvas* ctxcanvas, double angle);
void (*cxPalette)(cdCtxCanvas* ctxcanvas, int n, const long *palette, int mode);
long (*cxBackground)(cdCtxCanvas* ctxcanvas, long color);
long (*cxForeground)(cdCtxCanvas* ctxcanvas, long color);
void (*cxTransform)(cdCtxCanvas* ctxcanvas, const double* matrix);
void (*cxGetImageRGB)(cdCtxCanvas* ctxcanvas, unsigned char *r, unsigned char *g, unsigned char *b, int x, int y, int w, int h);
void (*cxPutImageRectRGB)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void (*cxPutImageRectRGBA)(cdCtxCanvas* ctxcanvas, 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);
void (*cxFPutImageRectRGB)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void (*cxFPutImageRectRGBA)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void (*cxFPutImageRectMap)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void (*cxScrollArea)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
cdCtxImage* (*cxCreateImage)(cdCtxCanvas* ctxcanvas, int w, int h);
void (*cxKillImage)(cdCtxImage* ctximage);
void (*cxGetImage)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y);
void (*cxPutImageRect)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y, int xmin, int xmax, int ymin, int ymax);
void (*cxNewRegion)(cdCtxCanvas* ctxcanvas);
int (*cxIsPointInRegion)(cdCtxCanvas* ctxcanvas, int x, int y);
void (*cxOffsetRegion)(cdCtxCanvas* ctxcanvas, int x, int y);
void (*cxGetRegionBox)(cdCtxCanvas* ctxcanvas, int *xmin, int *xmax, int *ymin, int *ymax);
int (*cxActivate)(cdCtxCanvas* ctxcanvas);
void (*cxDeactivate)(cdCtxCanvas* ctxcanvas);
/* the driver must update these, when the canvas is created and
whenever the canvas change its size or bpp. */
int w,h; /* size in pixels */ /**** pixel = mm * res ****/
double w_mm, h_mm; /* size in mm */ /**** mm = pixel / res ****/
double xres, yres; /* resolution in pixels/mm */ /**** res = pixel / mm ****/
int bpp; /* number of bits per pixel */
int invert_yaxis; /* invert Y coordinates before calling the driver,
used only when the native Y axis orientation is top-bottom "!(cap&CD_CAP_YAXIS)".
It is turned off by the driver if native transformation matrix is used. */
double matrix[6];
int use_matrix;
/* clipping attributes */
int clip_mode;
cdRect clip_rect;
cdfRect clip_frect;
int clip_poly_n;
cdPoint* clip_poly; /* only defined if integer polygon created, if exist clip_fpoly is NULL, and ->Poly exists */
cdfPoint* clip_fpoly; /* only defined if real polygon created, if exist clip_poly is NULL, and ->fPoly exists */
/* clipping region attributes */
int new_region;
int combine_mode;
/* color attributes */
long foreground, background;
int back_opacity, write_mode;
/* primitive attributes */
int mark_type, mark_size;
int line_style, line_width;
int line_cap, line_join;
int* line_dashes;
int line_dashes_count;
int interior_style, hatch_style;
int fill_mode;
char font_type_face[1024];
int font_style, font_size;
int text_alignment;
double text_orientation;
char native_font[1024];
int pattern_w, pattern_h, pattern_size;
long* pattern;
int stipple_w, stipple_h, stipple_size;
unsigned char* stipple;
/* origin */
int use_origin;
cdPoint origin; /* both points contains the same coordinate always */
cdfPoint forigin;
/* last polygon */
int poly_mode,
poly_n, /* current number of vertices */
poly_size, fpoly_size; /* allocated number of vertices, only increases */
cdPoint* poly; /* used during an integer polygon creation */
cdfPoint* fpoly; /* used during an real polygon creation, only if ->cxFPoly exists */
int use_fpoly;
/* last path */
int path_n, /* current number of actions */
path_size; /* allocated number of actions, only increases */
int* path; /* used during path creation */
int path_arc_index; /* used for arc */
/* simulation flags */
int sim_mode;
/* WC */
double s, sx, tx, sy, ty; /* Transform Window -> Viewport (scale+translation)*/
cdfRect window; /* Window in WC */
cdRect viewport; /* Viewport in pixels */
cdAttribute* attrib_list[50];
int attrib_n;
cdVectorFont* vector_font;
cdSimulation* simulation;
cdCtxCanvas* ctxcanvas;
cdContext* context;
void* userdata;
};
enum{CD_BASE_WIN, CD_BASE_X, CD_BASE_GDK, CD_BASE_HAIKU};
int cdBaseDriver(void);
/***************/
/* attributes */
/***************/
void cdRegisterAttribute(cdCanvas* canvas, cdAttribute* attrib);
void cdUpdateAttributes(cdCanvas* canvas);
/***************/
/* vector font */
/***************/
cdVectorFont* cdCreateVectorFont(cdCanvas* canvas);
void cdKillVectorFont(cdVectorFont* vector_font_data);
/**********/
/* WC */
/**********/
void wdSetDefaults(cdCanvas* canvas);
/********************/
/* Context Plus */
/********************/
void cdInitContextPlusList(cdContext* ctx_list[]);
cdContext* cdGetContextPlus(int ctx);
enum{CD_CTXPLUS_NATIVEWINDOW, CD_CTXPLUS_IMAGE, CD_CTXPLUS_DBUFFER, CD_CTXPLUS_PRINTER, CD_CTXPLUS_EMF, CD_CTXPLUS_CLIPBOARD};
#define CD_CTXPLUS_COUNT 6
#define CD_CTX_PLUS 0xFF00 /* to combine with context type */
/*************/
/* utilities */
/*************/
int cdRound(double x);
int cdCheckBoxSize(int *xmin, int *xmax, int *ymin, int *ymax);
int cdfCheckBoxSize(double *xmin, double *xmax, double *ymin, double *ymax);
void cdNormalizeLimits(int w, int h, int *xmin, int *xmax, int *ymin, int *ymax);
int cdGetFileName(const char* strdata, char* filename);
int cdStrEqualNoCase(const char* str1, const char* str2);
int cdStrEqualNoCasePartial(const char* str1, const char* str2);
int cdStrLineCount(const char* str);
char* cdStrDup(const char* str);
char* cdStrDupN(const char* str, int len);
int cdStrIsAscii(const char* str);
char* cdStrConvertToUTF8(const char* str, int len, char* utf8_buffer, int *utf8_buffer_len, int utf8mode);
void cdSetPaperSize(int size, double *w_pt, double *h_pt);
int cdGetFontFileName(const char* type_face, char* filename);
int cdGetFontFileNameDefault(const char *type_face, int style, char* filename);
int cdGetFontFileNameSystem(const char *type_face, int style, char* filename);
int cdStrTmpFileName(char* filename);
int cdMakeDirectory(const char *path);
int cdIsDirectory(const char* path);
int cdRemoveDirectory(const char *path);
void cdCopyFile(const char* srcFile, const char* destFile);
typedef struct _cdDirData
{
const char* path;
char filename[1024];
int isDir;
int closed;
void* handle;
} cdDirData;
cdDirData* cdDirIterOpen(const char *path);
int cdDirIter(cdDirData * dirData);
void cdDirClose(cdDirData* dirData);
void cdPoly(cdCanvas* canvas, int mode, cdPoint* points, int n);
void cdGetArcBox(int xc, int yc, int w, int h, double a1, double a2, int *xmin, int *xmax, int *ymin, int *ymax);
int cdGetArcPathF(const cdPoint* poly, double *xc, double *yc, double *w, double *h, double *a1, double *a2);
int cdfGetArcPath(const cdfPoint* poly, double *xc, double *yc, double *w, double *h, double *a1, double *a2);
int cdGetArcPath(const cdPoint* poly, int *xc, int *yc, int *w, int *h, double *a1, double *a2);
void cdGetArcStartEnd(int xc, int yc, int w, int h, double a1, double a2, int *x1, int *y1, int *x2, int *y2);
void cdfGetArcStartEnd(double xc, double yc, double w, double h, double a1, double a2, double *x1, double *y1, double *x2, double *y2);
#define _cdCheckCanvas(_canvas) (_canvas!=NULL && ((unsigned char*)_canvas)[0] == 'C' && ((unsigned char*)_canvas)[1] == 'D')
#define _cdSwapInt(_a,_b) {int _c=_a;_a=_b;_b=_c;}
#define _cdSwapDouble(_a,_b) {double _c=_a;_a=_b;_b=_c;}
#define _cdRound(_x) ((int)(_x < 0? (_x-0.5): (_x+0.5)))
#define _cdRotateHatch(_x) ((_x) = ((_x)<< 1) | ((_x)>>7))
#define _cdInvertYAxis(_canvas, _y) (_canvas->h - (_y) - 1)
/******************/
/* Transformation */
/******************/
void cdMatrixTransformPoint(double* matrix, int x, int y, int *rx, int *ry);
void cdfMatrixTransformPoint(double* matrix, double x, double y, double *rx, double *ry);
void cdMatrixMultiply(const double* matrix, double* mul_matrix);
void cdMatrixInverse(const double* matrix, double* inv_matrix);
void cdfRotatePoint(cdCanvas* canvas, double x, double y, double cx, double cy, double *rx, double *ry, double sin_theta, double cos_theta);
void cdRotatePoint(cdCanvas* canvas, int x, int y, int cx, int cy, int *rx, int *ry, double sin_teta, double cos_teta);
void cdRotatePointY(cdCanvas* canvas, int x, int y, int cx, int cy, int *ry, double sin_theta, double cos_theta);
void cdfRotatePointY(cdCanvas* canvas, double x, double y, double cx, double cy, double *ry, double sin_theta, double cos_theta);
void cdTextTranslatePoint(cdCanvas* canvas, int x, int y, int w, int h, int baseline, int *rx, int *ry);
void cdfTextTranslatePoint(cdCanvas* canvas, double x, double y, int w, int h, int baseline, double *rx, double *ry);
void cdMovePoint(int *x, int *y, double dx, double dy, double sin_theta, double cos_theta);
void cdfMovePoint(double *x, double *y, double dx, double dy, double sin_theta, double cos_theta);
/*************/
/* Fonts */
/*************/
int cdParsePangoFont(const char *nativefont, char *type_face, int *style, int *size);
int cdParseIupWinFont(const char *nativefont, char *type_face, int *style, int *size);
int cdParseXWinFont(const char *nativefont, char *type_face, int *style, int *size);
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 */
/****************/
unsigned char cdZeroOrderInterpolation(int width, int height, const unsigned char *map, double xl, double yl);
unsigned char cdBilinearInterpolation(int width, int height, const unsigned char *map, double xl, double yl);
void cdImageRGBInitInverseTransform(int w, int h, int xmin, int xmax, int ymin, int ymax, double *xfactor, double *yfactor, const double* matrix, double* inv_matrix);
void cdImageRGBInverseTransform(int t_x, int t_y, double *i_x, double *i_y, double xfactor, double yfactor, int xmin, int ymin, int x, int y, double *inv_matrix);
void cdImageRGBCalcDstLimits(cdCanvas* canvas, int x, int y, int w, int h, int *xmin, int *xmax, int *ymin, int *ymax, int* rect);
void cdRGB2Gray(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, long *color);
#define CD_ALPHA_BLEND(_src,_dst,_alpha) (unsigned char)(((_src) * (_alpha) + (_dst) * (255 - (_alpha))) / 255)
int* cdGetZoomTable(int w, int rw, int xmin);
int cdCalcZoom(int canvas_size, int cnv_rect_pos, int cnv_rect_size,
int *new_cnv_rect_pos, int *new_cnv_rect_size,
int img_rect_pos, int img_rect_size,
int *new_img_rect_pos, int *new_img_rect_size, int is_horizontal);
/**************/
/* simulation */
/**************/
/* sim.c */
/* simulation base driver. */
cdSimulation* cdCreateSimulation(cdCanvas* canvas);
void cdKillSimulation(cdSimulation* simulation);
void cdSimulationInitText(cdSimulation* simulation);
/* sim_text.c */
/* Replacements for Text and Font using FreeType library */
void cdSimulationText(cdCtxCanvas* ctxcanvas, int x, int y, const char *s, int len);
int cdSimulationFont(cdCtxCanvas* ctxcanvas, const char *type_face, int style, int size);
void cdSimulationGetFontDim(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent);
void cdSimulationGetTextSize(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height);
/* sim_linepolyfill.c */
void cdfSimulationPoly(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* fpoly, int n);
void cdSimulationPoly(cdCtxCanvas* ctxcanvas, int mode, cdPoint* poly, int n);
/* sim_primitives.c */
/* Simulation functions that are >> independent << of the simulation base driver. */
void cdSimMark(cdCanvas* canvas, int x, int y);
void cdfSimMark(cdCanvas* canvas, double x, double 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);
void cdSimPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdfSimPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void cdfSimPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, const unsigned char *a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
/* All these use cdPoly. */
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);
/* All these use the polygon method ->cxFPoly only. */
/* can be used only by drivers that implement cxFPoly */
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 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);
#ifdef __cplusplus
}
#endif
#endif
-45
View File
@@ -1,45 +0,0 @@
/** \file
* \brief Cairo extra drivers.
* Rendering PDF, PS, SVG and IMAGERGB.
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_CAIRO_H
#define __CD_CAIRO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Some of these context can be used directly or by cdInitContextPlus,
as CD_NATIVEWINDOW, CD_IMAGE, CD_EMF, CD_PRINTER and CD_DBUFFER.
The others only directly.
*/
cdContext* cdContextCairoNativeWindow(void);
cdContext* cdContextCairoImage(void);
cdContext* cdContextCairoDBuffer(void);
cdContext* cdContextCairoPrinter(void);
cdContext* cdContextCairoPS(void);
cdContext* cdContextCairoPDF(void);
cdContext* cdContextCairoSVG(void);
cdContext* cdContextCairoImageRGB(void);
cdContext* cdContextCairoEMF(void);
#define CD_CAIRO_NATIVEWINDOW cdContextCairoNativeWindow()
#define CD_CAIRO_IMAGE cdContextCairoImage()
#define CD_CAIRO_DBUFFER cdContextCairoDBuffer()
#define CD_CAIRO_PRINTER cdContextCairoPrinter()
#define CD_CAIRO_PS cdContextCairoPS()
#define CD_CAIRO_PDF cdContextCairoPDF()
#define CD_CAIRO_SVG cdContextCairoSVG()
#define CD_CAIRO_IMAGERGB cdContextCairoImageRGB()
#define CD_CAIRO_EMF cdContextCairoEMF()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_CAIRO_ */
-34
View File
@@ -1,34 +0,0 @@
/** \file
* \brief CGM driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_CGM_H
#define __CD_CGM_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextCGM(void);
#define CD_CGM cdContextCGM()
#define CD_CGMCOUNTERCB 1
#define CD_CGMSCLMDECB 2
#define CD_CGMVDCEXTCB 3
#define CD_CGMBEGPICTCB 4
#define CD_CGMBEGPICTBCB 5
#define CD_CGMBEGMTFCB 6
/* OLD definitions, defined for backward compatibility */
#define CDPLAY_ABORT CD_ABORT
#define CDPLAY_GO CD_CONTINUE
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_CGM_ */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief Clipboard driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_CLIPBOARD_H
#define __CD_CLIPBOARD_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextClipboard(void);
#define CD_CLIPBOARD cdContextClipboard()
#ifdef __cplusplus
}
#endif
#endif
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief Double Buffer driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_DBUF_H
#define __CD_DBUF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextDBuffer(void);
#define CD_DBUFFER cdContextDBuffer()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_DBUF_ */
-24
View File
@@ -1,24 +0,0 @@
/** \file
* \brief CD Debug driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_DEBUG_H
#define __CD_DEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextDebug(void);
#define CD_DEBUG cdContextDebug()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_DEBUG_H */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief DGN driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_DGN_H
#define __CD_DGN_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextDGN(void);
#define CD_DGN cdContextDGN()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_DGN_ */
-35
View File
@@ -1,35 +0,0 @@
/** \file
* \brief Direct2D extra drivers.
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_DIRECT2D_H
#define __CD_DIRECT2D_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextDirect2DNativeWindow(void); /* already double buffered */
cdContext* cdContextDirect2DImage(void); /* to draw on an image */
cdContext* cdContextDirect2DImageRGB(void); /* to draw on an RGBA image */
cdContext* cdContextDirect2DDBuffer(void); /* Not necessary, used to test image drawing */
cdContext* cdContextDirect2DPrinter(void); /* NOT working */
#define CD_DIRECT2D_NATIVEWINDOW cdContextDirect2DNativeWindow()
#define CD_DIRECT2D_IMAGE cdContextDirect2DImage()
#define CD_DIRECT2D_IMAGERGB cdContextDirect2DImageRGB()
#define CD_DIRECT2D_DBUFFER cdContextDirect2DDBuffer()
#define CD_DIRECT2D_PRINTER cdContextDirect2DPrinter()
void cdInitDirect2D(void);
void cdFinishDirect2D(void);
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_DIRECT2D_H */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief DXF driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_DXF_H
#define __CD_DXF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextDXF(void);
#define CD_DXF cdContextDXF()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_DXF_ */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief EMF driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_EMF_H
#define __CD_EMF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextEMF(void);
#define CD_EMF cdContextEMF()
#ifdef __cplusplus
}
#endif
#endif
-29
View File
@@ -1,29 +0,0 @@
/** \file
* \brief GDI+ Control
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_GDIPLUS_H
#define __CD_GDIPLUS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
void cdInitGdiPlus(void); /* old function, replaced by cdInitContextPlus */
#else
#define cdInitGdiPlus() (0)
#endif
/* Windows GDI+ Adicional Polygons */
#define CD_SPLINE (CD_POLYCUSTOM+0)
#define CD_FILLSPLINE (CD_POLYCUSTOM+1)
#define CD_FILLGRADIENT (CD_POLYCUSTOM+2)
#ifdef __cplusplus
}
#endif
#endif /* ifndef _CD_GDIPLUS_ */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief OpenGL driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_GL_H
#define __CD_GL_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextGL(void);
#define CD_GL cdContextGL()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_GL_ */
-33
View File
@@ -1,33 +0,0 @@
/** \file
* \brief imImage driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_IM_H
#define __CD_IM_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextImImage(void);
#define CD_IMIMAGE cdContextImImage()
#ifdef __IM_IMAGE_H
void cdCanvasPatternImImage(cdCanvas* canvas, const imImage* image);
void cdCanvasStippleImImage(cdCanvas* canvas, const imImage* image);
void cdCanvasPutImImage(cdCanvas* canvas, const imImage* image, int x, int y, int w, int h);
void cdCanvasGetImImage(cdCanvas* canvas, imImage* image, int x, int y);
void cdfCanvasPutImImage(cdCanvas* canvas, const imImage* image, double x, double y, double w, double h);
void wdCanvasPutImImage(cdCanvas* canvas, const imImage* image, double x, double y, double w, double h);
void wdCanvasGetImImage(cdCanvas* canvas, imImage* image, double x, double y);
#endif
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_IM_ */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief Server Image driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_IMAGE_H
#define __CD_IMAGE_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextImage(void);
#define CD_IMAGE cdContextImage()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_IMAGE_ */
-32
View File
@@ -1,32 +0,0 @@
/** \file
* \brief IMAGERGB driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_IRGB_H
#define __CD_IRGB_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextImageRGB(void);
cdContext* cdContextDBufferRGB(void);
#define CD_IMAGERGB cdContextImageRGB()
#define CD_DBUFFERRGB cdContextDBufferRGB()
/* DEPRECATED functions, use REDIMAGE, GREENIMAGE,
BLUEIMAGE, and ALPHAIMAGE attributes. */
unsigned char* cdRedImage(cdCanvas* cnv);
unsigned char* cdGreenImage(cdCanvas* cnv);
unsigned char* cdBlueImage(cdCanvas* cnv);
unsigned char* cdAlphaImage(cdCanvas* cnv);
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_IRGB_ */
-29
View File
@@ -1,29 +0,0 @@
/** \file
* \brief IUP driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_IUP_H
#define __CD_IUP_H
#ifdef __cplusplus
extern "C" {
#endif
/* NOTICE: implemented in IUP at the IUPCD library.
Only this file is at the CD includes. */
cdContext* cdContextIup(void);
cdContext* cdContextIupDBuffer(void);
cdContext* cdContextIupDBufferRGB(void);
#define CD_IUP cdContextIup()
#define CD_IUPDBUFFER cdContextIupDBuffer()
#define CD_IUPDBUFFERRGB cdContextIupDBufferRGB()
#ifdef __cplusplus
}
#endif
#endif
-40
View File
@@ -1,40 +0,0 @@
/** \file
* \brief Lua Binding Control
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_LUA_H
#define __CD_LUA_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUA_NOOBJECT /* Lua 3 */
void cdlua_open(void);
void cdlua_close(void);
/* utilities */
cdCanvas* cdlua_getcanvas(void); /* pos=1, deprecated use cdlua_checkcanvas */
cdCanvas* cdlua_checkcanvas(int pos);
void cdlua_pushcanvas(cdCanvas* canvas);
#endif
#ifdef LUA_TNONE /* Lua 5 */
int cdlua_open(lua_State *L);
int cdlua_close(lua_State *L);
/* utilities */
cdCanvas* cdlua_getcanvas(lua_State * L); /* pos=1, deprecated use cdlua_checkcanvas */
cdCanvas* cdlua_checkcanvas(lua_State * L, int pos);
void cdlua_pushcanvas(lua_State * L, cdCanvas* canvas);
#endif
#ifdef __cplusplus
}
#endif
#endif
-120
View File
@@ -1,120 +0,0 @@
/** \file
* \brief Private Lua 3 Binding Functions
*
* See Copyright Notice in cd.h
*/
#ifndef __CDLUA3_PRIVATE_H
#define __CDLUA3_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
#define COLOR_TAG "CDLUA_COLOR_TAG"
#define CANVAS_TAG "CDLUA_CANVAS_TAG"
#define STATE_TAG "CDLUA_STATE_TAG"
#define BITMAP_TAG "CDLUA_BITMAP_TAG"
#define IMAGE_TAG "CDLUA_IMAGE_TAG"
#define IMAGERGB_TAG "CDLUA_IMAGERGB_TAG"
#define IMAGERGBA_TAG "CDLUA_IMAGERGBA_TAG"
#define STIPPLE_TAG "CDLUA_STIPPLE_TAG"
#define PATTERN_TAG "CDLUA_PATTERN_TAG"
#define PALETTE_TAG "CDLUA_PALETTE_TAG"
#define IMAGEMAP_TAG "CDLUA_IMAGEMAP_TAG"
#define CHANNEL_TAG "CDLUA_CHANNEL_TAG"
/* context management */
typedef struct _cdCallbackLUA {
int lock;
char *name;
cdCallback func;
} cdCallbackLUA;
typedef struct _cdContextLUA {
int id;
char *name;
cdContext* (*ctx)(void);
void* (*checkdata)(int param);
cdCallbackLUA* cb_list;
int cb_n;
} cdContextLUA;
void cdlua_addcontext(cdContextLUA* luactx);
void cdlua_register(char* name, lua_CFunction func);
void cdlua_pushnumber(double num, char* name);
/* tag management */
typedef struct _canvas_t {
cdCanvas *cd_canvas;
} canvas_t;
typedef struct _state_t {
cdState *state;
} state_t;
typedef struct _stipple_t {
unsigned char *value;
int width;
int height;
long int size;
} stipple_t;
typedef struct _pattern_t {
long int *color;
int width;
int height;
long int size;
} pattern_t;
typedef struct _palette_t {
long int *color;
long int size;
} palette_t;
typedef struct _image_t {
void *cd_image;
} image_t;
typedef struct _imagergb_t {
unsigned char *red;
unsigned char *green;
unsigned char *blue;
int width;
int height;
long int size;
} imagergb_t;
typedef struct _imagergba_t {
unsigned char *red;
unsigned char *green;
unsigned char *blue;
unsigned char *alpha;
int width;
int height;
long int size;
} imagergba_t;
typedef struct _imagemap_t {
unsigned char *index;
int width;
int height;
long int size;
} imagemap_t;
typedef struct _channel_t {
unsigned char *value;
long int size;
} channel_t;
typedef struct _bitmap_t {
cdBitmap *image;
} bitmap_t;
#ifdef __cplusplus
}
#endif
#endif
-145
View File
@@ -1,145 +0,0 @@
/** \file
* \brief Private Lua 5 Binding Functions
*
* See Copyright Notice in cd.h
*/
#ifndef __CDLUA5_PRIVATE_H
#define __CDLUA5_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/* context management */
typedef struct _cdluaCallback {
int lock;
const char* name;
cdCallback func;
} cdluaCallback;
typedef struct _cdluaContext {
int id;
const char* name;
cdContext* (*ctx)(void);
void* (*checkdata)(lua_State* L,int param);
cdluaCallback* cb_list;
int cb_n;
} cdluaContext;
typedef struct _cdluaLuaState {
cdCanvas* void_canvas; /* the VOID canvas to avoid a NULL active canvas */
cdluaContext* drivers[50]; /* store the registered drivers, map integer values to cdContext */
int numdrivers;
} cdluaLuaState;
/* metatables */
typedef struct _cdluaStipple {
unsigned char* stipple;
int width;
int height;
long int size;
} cdluaStipple;
typedef struct _cdluaPattern {
long* pattern;
int width;
int height;
long int size;
} cdluaPattern;
/* this is the same declaration used in the IM toolkit for imPalette in Lua */
typedef struct _cdluaPalette {
long* color;
int count;
} cdluaPalette;
typedef struct _cdluaImageRGB {
unsigned char* red;
unsigned char* green;
unsigned char* blue;
int width;
int height;
long int size;
int free;
} cdluaImageRGB;
typedef struct _cdluaImageRGBA {
unsigned char* red;
unsigned char* green;
unsigned char* blue;
unsigned char* alpha;
int width;
int height;
long int size;
int free;
} cdluaImageRGBA;
typedef struct _cdluaImageMap {
unsigned char* index;
int width;
int height;
long int size;
} cdluaImageMap;
typedef struct _cdluaImageChannel {
unsigned char* channel;
long int size;
} cdluaImageChannel;
cdluaLuaState* cdlua_getstate(lua_State* L);
cdluaContext* cdlua_getcontext(lua_State* L, int param);
lua_State* cdlua_getplaystate(void);
void cdlua_setplaystate(lua_State* L);
void cdlua_register_lib(lua_State *L, const luaL_Reg* funcs);
void cdlua_register_funcs(lua_State *L, const luaL_Reg* funcs);
void cdlua_kill_active(lua_State* L, cdCanvas* canvas);
void cdlua_open_active(lua_State* L, cdluaLuaState* cdL);
void cdlua_close_active(cdluaLuaState* cdL);
void cdlua_open_canvas(lua_State* L);
void cdlua_addcontext(lua_State* L, cdluaLuaState* cdL, cdluaContext* luactx);
void cdlua_initdrivers(lua_State* L, cdluaLuaState* cdL);
cdluaPalette* cdlua_checkpalette(lua_State* L, int param);
cdluaStipple* cdlua_checkstipple(lua_State* L, int param);
cdluaPattern* cdlua_checkpattern(lua_State* L, int param);
cdluaImageRGB* cdlua_checkimagergb(lua_State* L, int param);
cdluaImageRGBA* cdlua_checkimagergba(lua_State* L, int param);
cdluaImageMap* cdlua_checkimagemap(lua_State* L, int param);
cdluaImageChannel* cdlua_checkchannel(lua_State* L, int param);
long cdlua_checkcolor(lua_State* L, int param);
cdImage* cdlua_checkimage(lua_State* L, int param);
cdState* cdlua_checkstate(lua_State* L, int param);
cdBitmap* cdlua_checkbitmap(lua_State* L, int param);
void cdlua_pushcolor(lua_State* L, long color);
void cdlua_pushpalette(lua_State* L, long* palette, int size);
void cdlua_pushstipple(lua_State* L, unsigned char* stipple, int width, int height);
void cdlua_pushpattern(lua_State* L, long int* pattern, int width, int height);
void cdlua_pushimagergb(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, int width, int height);
void cdlua_pushimagergba(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha, int width, int height);
void cdlua_pushimagemap(lua_State* L, unsigned char* index, int width, int height);
void cdlua_pushchannel(lua_State* L, unsigned char* channel, int size);
void cdlua_pushimage(lua_State* L, cdImage* image);
void cdlua_pushstate(lua_State* L, cdState* state);
void cdlua_pushbitmap(lua_State* L, cdBitmap* bitmap);
void cdlua_pushimagergb_ex(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, int width, int height);
void cdlua_pushimagergba_ex(lua_State* L, unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha, int width, int height);
#ifdef __cplusplus
}
#endif
#endif
-27
View File
@@ -1,27 +0,0 @@
/** \file
* \brief OpenGL Canvas Lua Binding
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_LUAGL_H
#define __CD_LUAGL_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUA_NOOBJECT /* Lua 3 */
void cdluagl_open(void);
#endif
#ifdef LUA_TNONE /* Lua 5 */
int cdluagl_open(lua_State *L);
#endif
#ifdef __cplusplus
}
#endif
#endif
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief CD+IM Lua Binding
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_LUAIM_H
#define __CD_LUAIM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUA_TNONE /* Lua 5 */
int cdluaim_open(lua_State *L);
#endif
#ifdef __cplusplus
}
#endif
#endif
-27
View File
@@ -1,27 +0,0 @@
/** \file
* \brief IUP Canvas Lua Binding
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_LUAIUP_H
#define __CD_LUAIUP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUA_NOOBJECT /* Lua 3 */
void cdluaiup_open(void);
#endif
#ifdef LUA_TNONE /* Lua 5 */
int cdluaiup_open(lua_State *L);
#endif
#ifdef __cplusplus
}
#endif
#endif
-27
View File
@@ -1,27 +0,0 @@
/** \file
* \brief PDF Canvas Lua Binding
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_LUAPDF_H
#define __CD_LUAPDF_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUA_NOOBJECT /* Lua 3 */
void cdluapdf_open(void);
#endif
#ifdef LUA_TNONE /* Lua 5 */
int cdluapdf_open(lua_State *L);
#endif
#ifdef __cplusplus
}
#endif
#endif
-24
View File
@@ -1,24 +0,0 @@
/** \file
* \brief CD Metafile driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_MF_H
#define __CD_MF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextMetafile(void);
#define CD_METAFILE cdContextMetafile()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_MF_ */
-32
View File
@@ -1,32 +0,0 @@
/** \file
* \brief CD Metafile driver private declarations
*
* See Copyright Notice in cd.h
*/
#ifndef __CDMF_PRIVATE_H
#define __CDMF_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/* public part of the internal cdCtxCanvas */
typedef struct cdCanvasMF
{
cdCanvas* canvas;
char* filename;
void* data;
} cdCanvasMF;
void cdcreatecanvasMF(cdCanvas *canvas, void *data);
void cdinittableMF(cdCanvas* canvas);
void cdkillcanvasMF(cdCanvasMF *mfcanvas);
#ifdef __cplusplus
}
#endif
#endif
-26
View File
@@ -1,26 +0,0 @@
/** \file
* \brief NativeWindow driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_NATIVE_H
#define __CD_NATIVE_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextNativeWindow(void);
#define CD_NATIVEWINDOW cdContextNativeWindow()
void cdGetScreenSize(int *width, int *height, double *width_mm, double *height_mm);
int cdGetScreenColorPlanes(void);
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_NATIVE_ */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief PDF driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PDF_H
#define __CD_PDF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextPDF(void);
#define CD_PDF cdContextPDF()
#ifdef __cplusplus
}
#endif
#endif /* ifndef _CD_PDF_ */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief CD Picture driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PICTURE_H
#define __CD_PICTURE_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextPicture(void);
#define CD_PICTURE cdContextPicture()
#ifdef __cplusplus
}
#endif
#endif
-21
View File
@@ -1,21 +0,0 @@
/** \file
* \brief PPTX driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PPTX_H
#define __CD_PPTX_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextPPTX(void);
#define CD_PPTX cdContextPPTX()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_PPTX_ */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief Printer driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PRINTER_H
#define __CD_PRINTER_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextPrinter(void);
#define CD_PRINTER cdContextPrinter()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_PRINTER_ */
-23
View File
@@ -1,23 +0,0 @@
/** \file
* \brief PS driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_PS_H
#define __CD_PS_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextPS(void);
#define CD_PS cdContextPS()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_PS_ */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief SVG driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_SVG_H
#define __CD_SVG_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextSVG(void);
#define CD_SVG cdContextSVG()
#ifdef __cplusplus
}
#endif
#endif /* ifndef __CD_SVG_ */
-22
View File
@@ -1,22 +0,0 @@
/** \file
* \brief WMF driver
*
* See Copyright Notice in cd.h
*/
#ifndef __CD_WMF_H
#define __CD_WMF_H
#ifdef __cplusplus
extern "C" {
#endif
cdContext* cdContextWMF(void);
#define CD_WMF cdContextWMF()
#ifdef __cplusplus
}
#endif
#endif
-88
View File
@@ -1,88 +0,0 @@
/** \file
* \brief World Coordinate Functions
*
* See Copyright Notice in cd.h
*/
#ifndef __WD_H
#define __WD_H
#ifdef __cplusplus
extern "C" {
#endif
int wdCanvasPlay(cdCanvas* canvas, cdContext *context, double xmin, double xmax, double ymin, double ymax, void *data);
/* coordinate transformation */
void wdCanvasWindow(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void wdCanvasGetWindow(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
void wdCanvasViewport(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
void wdCanvasGetViewport(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
void wdCanvasWorld2Canvas(cdCanvas* canvas, double xw, double yw, int *xv, int *yv);
void wdCanvasWorld2CanvasSize(cdCanvas* canvas, double hw, double vw, int *hv, int *vv);
void wdCanvasCanvas2World(cdCanvas* canvas, int xv, int yv, double *xw, double *yw);
void wdCanvasSetTransform(cdCanvas* canvas, double sx, double sy, double tx, double ty);
void wdCanvasGetTransform(cdCanvas* canvas, double *sx, double *sy, double *tx, double *ty);
void wdCanvasTranslate(cdCanvas* canvas, double dtx, double dty);
void wdCanvasScale(cdCanvas* canvas, double dsx, double dsy);
void wdCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
int wdCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
int wdCanvasIsPointInRegion(cdCanvas* canvas, double x, double y);
void wdCanvasOffsetRegion(cdCanvas* canvas, double x, double y);
void wdCanvasGetRegionBox(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
void wdCanvasHardcopy(cdCanvas* canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy));
/* primitives */
void wdCanvasPixel(cdCanvas* canvas, double x, double y, long color);
void wdCanvasMark(cdCanvas* canvas, double x, double y);
void wdCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
void wdCanvasVertex(cdCanvas* canvas, double x, double y);
void wdCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void wdCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void wdCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void wdCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void wdCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void wdCanvasText(cdCanvas* canvas, double x, double y, const char* s);
void wdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, double x, double y, int iw, int ih);
void wdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, double x, double y, double w, double h);
/* attributes */
double wdCanvasLineWidth(cdCanvas* canvas, double width);
int wdCanvasFont(cdCanvas* canvas, const char* type_face, int style, double size);
void wdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, double *size);
double wdCanvasMarkSize(cdCanvas* canvas, double size);
void wdCanvasGetFontDim(cdCanvas* canvas, double *max_width, double *height, double *ascent, double *descent);
void wdCanvasGetTextSize(cdCanvas* canvas, const char* s, double *width, double *height);
void wdCanvasGetTextBox(cdCanvas* canvas, double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char* s, double *rect);
void wdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char*fgbg, double w_mm, double h_mm);
void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w_mm, double h_mm);
/* vector text */
void wdCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2);
void wdCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const char* s);
void wdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, double *x, double *y);
double wdCanvasVectorCharSize(cdCanvas* canvas, double size);
void wdCanvasVectorText(cdCanvas* canvas, double x, double y, const char* s);
void wdCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const char* s);
void wdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, double x, double y, double *rect);
void wdCanvasGetVectorTextBox(cdCanvas* canvas, double x, double y, const char *s, double *xmin, double *xmax, double *ymin, double *ymax);
#ifdef __cplusplus
}
#endif
#ifndef CD_NO_OLD_INTERFACE
#include "wd_old.h"
#endif
#endif
-85
View File
@@ -1,85 +0,0 @@
/** \file
* \brief Old WC API
*
* See Copyright Notice in cd.h
*/
#ifndef WD_OLD_H
#define WD_OLD_H
#ifdef __cplusplus
extern "C" {
#endif
/* coordinate transformation */
void wdWindow(double xmin, double xmax, double ymin, double ymax);
void wdGetWindow(double *xmin, double *xmax, double *ymin, double *ymax);
void wdViewport(int xmin, int xmax, int ymin, int ymax);
void wdGetViewport(int *xmin, int *xmax, int *ymin, int *ymax);
void wdWorld2Canvas(double xw, double yw, int *xv, int *yv);
void wdWorld2CanvasSize(double hw, double vw, int *hv, int *vv);
void wdCanvas2World(int xv, int yv, double *xw, double *yw);
void wdClipArea(double xmin, double xmax, double ymin, double ymax);
int wdGetClipArea(double *xmin, double *xmax, double *ymin, double *ymax);
double* wdGetClipPoly(int *n);
int wdPointInRegion(double x, double y);
void wdOffsetRegion(double x, double y);
void wdRegionBox(double *xmin, double *xmax, double *ymin, double *ymax);
void wdHardcopy(cdContext* ctx, void *data, cdCanvas *cnv, void(*draw_func)(void));
/* primitives */
void wdPixel(double x, double y, long color);
void wdMark(double x, double y);
void wdLine(double x1, double y1, double x2, double y2);
void wdVertex(double x, double y);
void wdRect(double xmin, double xmax, double ymin, double ymax);
void wdBox(double xmin, double xmax, double ymin, double ymax);
void wdArc(double xc, double yc, double w, double h, double angle1, double angle2);
void wdSector(double xc, double yc, double w, double h, double angle1, double angle2);
void wdChord(double xc, double yc, double w, double h, double angle1, double angle2);
void wdText(double x, double y, const char* s);
void wdPutImageRect(cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
void wdPutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdPutImageRectRGBA(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdPutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void wdPutBitmap(cdBitmap* bitmap, double x, double y, double w, double h);
/* attributes */
double wdLineWidth(double width);
void wdFont(int type_face, int style, double size);
void wdGetFont(int *type_face, int *style, double *size);
double wdMarkSize(double size);
void wdFontDim(double *max_width, double *height, double *ascent, double *descent);
void wdTextSize(const char* s, double *width, double *height);
void wdTextBox(double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
void wdTextBounds(double x, double y, const char* s, double *rect);
void wdStipple(int w, int h, const unsigned char* stipple, double w_mm, double h_mm);
void wdPattern(int w, int h, const long* pattern, double w_mm, double h_mm);
/* vector text */
void wdVectorTextDirection(double x1, double y1, double x2, double y2);
void wdVectorTextSize(double size_x, double size_y, const char* s);
void wdGetVectorTextSize(const char* s, double *x, double *y);
double wdVectorCharSize(double size);
void wdVectorText(double x, double y, const char* s);
void wdMultiLineVectorText(double x, double y, const char* s);
void wdGetVectorTextBounds(const char* s, double x, double y, double *rect);
/* OLD definitions, defined for backward compatibility */
#define wdVectorFont cdVectorFont
#define wdVectorTextTransform cdVectorTextTransform
#define wdActivate cdActivate
#define wdClip(mode) cdClip(mode)
#define wdBegin(mode) cdBegin(mode)
#define wdEnd() cdEnd();
#define wdMM2Pixel(mm_dx, mm_dy, dx, dy) cdMM2Pixel(mm_dx, mm_dy, dx, dy)
#define wdPixel2MM(dx, dy, mm_dx, mm_dy) cdPixel2MM(dx, dy, mm_dx, mm_dy)
#ifdef __cplusplus
}
#endif
#endif
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.