From 0912a15bbf5134a4cc46133a9af09634fc171b16 Mon Sep 17 00:00:00 2001 From: Koichi KAMICHI Date: Mon, 23 Feb 2009 03:18:25 +0000 Subject: [PATCH] Improved OTSU curve. --- engine/kagedf.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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){ -- 1.7.10.4