77b4735a7207cdd1eed0b135d0af67dd09b8b625
[chise/kage.git] / 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 KGString* finalAdjustment(const KGString *in);
49
50 int isIDS(const KGString *in);
51 void divideInto2(const KGString *in, KGString *partIDS1, KGString *partIDS3);
52 void divideInto3(const KGString *in, KGString *partIDS1, KGString *partIDS2, KGString *partIDS3);
53 void addStrokeWithTransform(const KGString *stroke, const int num, const int *tf, KGString *out, int mode);
54 void convertArray(int *buf, KGString *out, int size, int mode);
55 int * convertStroke(const char *in, int *a, int *size);
56 void convert99(const KGString *in, KGString *out);
57 void convert99calc(const char *in, KGString *out);
58
59 void DotsWidth(int *dlx, int *drx);
60 void DotsHeight(int *dly, int *dry);
61 void PartsWidth(const KGString *in, int *lx, int *rx);
62 void PartsHeight(const KGString *in, int *ly, int *ry);
63 KGString * CalcSizes(const KGString *in, int mode);
64 void DrawBox();
65 void CalcOptions(const KGString *in, int *mitsudo, int *flag, double *yoko, double *tate);
66 void DoDrawParts(const KGString *in, const int lx1, const double rf1, const int ly1, const double rfy1);
67 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);
68
69 void combineYoko2(const KGString *parts1, const KGString *parts3, int *result);
70 void combineYoko3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);
71 void combineTate2(const KGString *parts1, const KGString *parts3, int *result);
72 void combineTate3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);
73 void combineHame2(KGString *parts1, KGString *parts3, int *result, int surround);
74 //void combineHame2(const KGString *parts1, const KGString *parts3, int *result, int surround);
75
76 int initDB();
77 int closeDB();
78 void searchPartsData(const KGString *in, KGString *out);
79 void searchAliasData(const KGString *in, KGString *out);
80
81 png_bytepp initPng(int width, int height);
82 int closePng(int width, int height, png_bytepp canvas);
83 int writePng(int width, int height, png_bytepp image, FILE *fp);
84
85 void fillPolygon(kPoint *p, int number, int col, unsigned char **image);
86
87 #endif