From: Koichi KAMICHI Date: Mon, 23 Feb 2009 03:18:25 +0000 (+0000) Subject: Improved OTSU curve. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0912a15bbf5134a4cc46133a9af09634fc171b16;p=chise%2Fkage.git Improved OTSU curve. --- diff --git a/engine/kagedf.js b/engine/kagedf.js index ba51376..b7a826d 100755 --- a/engine/kagedf.js +++ b/engine/kagedf.js @@ -145,6 +145,9 @@ function dfDrawFont(kage, polygons, a1, a2, a3, x1, y1, x2, y2, x3, y3, x4, y4){ break; case 4: rate = 6; + if((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2) < 14400){ // smaller than 120 x 120 + rate = Math.sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2)) / 120 * 6; + } if(a3 == 5){ if(x1 == x2){ if(y1 < y2){ v = 1; } else{ v = -1; } @@ -178,14 +181,14 @@ function dfDrawFont(kage, polygons, a1, a2, a3, x1, y1, x2, y2, x3, y3, x4, y4){ tx2 = x2 + kage.kMage * Math.cos(rad) * v * rate; ty2 = y2 + kage.kMage * Math.sin(rad) * v * rate; } - tx3 = x3; + tx3 = x3; ty3 = y3; cdDrawLine(kage, polygons, x1, y1, tx1, ty1, a2, 1); cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, tx2, ty2, 1, 1); - if(tx3 - tx2 > 0){ // for closer position - cdDrawLine(kage, polygons, tx2, ty2, tx3, ty3, 6, 5); // bolder by force - } + if(tx3 - tx2 > 0){ // for closer position + cdDrawLine(kage, polygons, tx2, ty2, tx3, ty3, 6, 5); // bolder by force + } } else{ if(x1 == x2){