From b3dde5ae9edfc18690c2f5baf1ebba97fe3fa896 Mon Sep 17 00:00:00 2001 From: Koichi KAMICHI Date: Sat, 26 Feb 2005 08:14:25 +0000 Subject: [PATCH] Extended combining function (Hame). : Adjust size by its complexity. --- kagecgi/kagecgi.h | 3 ++- kagecgi/kagecomb.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/kagecgi/kagecgi.h b/kagecgi/kagecgi.h index ed1e55a..77b4735 100755 --- a/kagecgi/kagecgi.h +++ b/kagecgi/kagecgi.h @@ -70,7 +70,8 @@ void combineYoko2(const KGString *parts1, const KGString *parts3, int *result); void combineYoko3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result); void combineTate2(const KGString *parts1, const KGString *parts3, int *result); void combineTate3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result); -void combineHame2(const KGString *parts1, const KGString *parts3, int *result, int surround); +void combineHame2(KGString *parts1, KGString *parts3, int *result, int surround); +//void combineHame2(const KGString *parts1, const KGString *parts3, int *result, int surround); int initDB(); int closeDB(); diff --git a/kagecgi/kagecomb.c b/kagecgi/kagecomb.c index 875cd85..c32b07b 100755 --- a/kagecgi/kagecomb.c +++ b/kagecgi/kagecomb.c @@ -475,15 +475,66 @@ void combineTate3(const KGString *parts1, const KGString *parts2, const KGString result[11] = tempResult2[1] + (tempResult[7] - miny) * ((double)height2 / height); } -void combineHame2(const KGString *parts1, const KGString *parts3, int *result, int surround){ +void adjust(int *x, int *y, int x1, int y1, int x2, int y2, double ratio){ + if(*x <= x1){ + *x = 0 + *x * ratio; + } else if(x2 <= *x){ + *x = pngWidth - (pngWidth - *x) * ratio; + } + if(*y <= y1){ + *y = 0 + *y * ratio; + } else if(y2 <= *y){ + *y = pngHeight - (pngHeight - *y) * ratio; + } +} + +void combineHame2(KGString *parts1, KGString *parts3, int *result, int surround){ int i, flag; int *buf, strokes; double yoko, tate; int mitsu, flg_box; + int x1, x2, y1, y2; + double ratio; + KGString *temp; - flag = 0; CalcOptions(parts3, &mitsu, &flg_box, &yoko, &tate); + if(yoko * tate > 12){ + ratio = sqrt(12 / (yoko * tate)); + temp = kg_string_new(""); + buf = convertStroke(parts1->str, buf, &strokes); + for(i = 0; i < strokes; i++){ + if(buf[i * 11] == 9){ + x1 = buf[i * 11 + 3]; + y1 = buf[i * 11 + 4]; + x2 = buf[i * 11 + 5]; + y2 = buf[i * 11 + 6]; + i = strokes; + } + } + for(i = 0; i str); + } + + flag = 0; + //set results result[0] = 0; result[1] = 0; -- 1.7.10.4