Change box-shape judgement method. Fix gray color painting method.
[chise/kage.git] / kagecgi / kagecgi.h
1 //kagecgi.h
2 //
3
4 #include "kage.h"
5 #include "sysdep.h"
6
7 #ifndef _KAGECGI_H_
8 #define _KAGECGI_H_
9
10 // define for localhost environment
11 #define errorFileSize 3992
12 #define errorFileName "error.png"
13 #define pngFilePath "/var/www/v0.4/"
14 #define partsdbFileName "/var/www/kagedb/partsdb"
15 #define idsdbFileName "/var/www/kagedb/idsdb"
16 #define aliasdbFileName "/var/www/kagedb/aliasdb"
17
18 #define kBaseline 188
19 #define pngWidth 200
20 #define pngHeight 200
21 #define canvasWidth 400
22 #define canvasHeight 400
23
24 #define min(x1,x2) (((x1) > (x2))? (x2):(x1))
25 #define max(x1,x2) (((x1) > (x2))? (x1):(x2))
26
27 DB *kPartsdbDatabase;
28 DB *kIdsdbDatabase;
29 DB *kAliasdbDatabase;
30
31 FILE *debug;
32
33 png_bytepp kageCanvas;
34
35 int kDesign;
36 int kSize;
37 int kType;
38 int kInput;
39 KGString *kResultText;
40 int kMode;
41
42 void generateGlyph(const KGString *in, KGString *out);
43 void searchPartsData(const KGString *in, KGString *out);
44 void searchAliasData(const KGString *in, KGString *out);
45 void searchCacheData(const KGString *in, KGString *out);
46 void doCombine(const KGString *in, KGString *out);
47 void drawGlyph(const KGString *in, const int mode);
48
49 int isIDS(const KGString *in);
50 void divideInto2(const KGString *in, KGString *partIDS1, KGString *partIDS3);
51 void divideInto3(const KGString *in, KGString *partIDS1, KGString *partIDS2, KGString *partIDS3);
52 void addStrokeWithTransform(const KGString *stroke, const int num, const int *tf, KGString *out, int mode);
53 void convertArray(int *buf, KGString *out, int size, int mode);
54 int * convertStroke(const char *in, int *a, int *size);
55 void convert99(const KGString *in, KGString *out);
56 void convert99calc(const char *in, KGString *out);
57
58 void DotsWidth(int *dlx, int *drx);
59 void DotsHeight(int *dly, int *dry);
60 void PartsWidth(const KGString *in, int *lx, int *rx);
61 void PartsHeight(const KGString *in, int *ly, int *ry);
62 KGString * CalcSizes(const KGString *in, int mode);
63 void DrawBox();
64 void CalcOptions(const KGString *in, int *mitsudo, int *flag, double *yoko, double *tate);
65 void DoDrawParts(const KGString *in, const int lx1, const double rf1, const int ly1, const double rfy1);
66 void DoDrawMixFont(const KGString *in1, const int lx1, const double rf1, const KGString *in2, const int lx2, const double rf2, const int ly1, const double rfy1, const int ly2, const double rfy2);
67
68 void combineYoko2(const KGString *parts1, const KGString *parts3, int *result);
69 void combineYoko3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);
70 void combineTate2(const KGString *parts1, const KGString *parts3, int *result);
71 void combineTate3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);
72 void combineHame2(const KGString *parts1, const KGString *parts3, int *result, int surround);
73
74 int initDB();
75 int closeDB();
76 void searchPartsData(const KGString *in, KGString *out);
77 void searchAliasData(const KGString *in, KGString *out);
78
79 png_bytepp initPng(int width, int height);
80 int closePng(int width, int height, png_bytepp canvas);
81 int writePng(int width, int height, png_bytepp image, FILE *fp);
82
83 void fillPolygon(kPoint *p, int number, int col, unsigned char **image);
84
85 #endif