[tekui-devel] tekui: Visual API: Simplified vector image calculation; CheckMar...
Timm S. Mueller
tmueller at schulze-mueller.de
Thu Nov 20 22:40:07 CET 2008
details: http://hg.teklib.org/tekui/rev/640f2d89245f
changeset: 39:640f2d89245f
user: Timm S. Mueller <tmueller at schulze-mueller.de>
date: Fri Nov 14 18:10:42 2008 +0100
description:
Visual API: Simplified vector image calculation; CheckMark, MenuItem, PopList,
RadioButton, ScrollBar: Images now use an uniform scale factor
diffs (truncated from 341 to 100 lines):
diff -r ce9ae4bc70fd -r 640f2d89245f tek/lib/visual_api.c
--- a/tek/lib/visual_api.c Fri Nov 14 14:59:33 2008 +0100
+++ b/tek/lib/visual_api.c Fri Nov 14 18:10:42 2008 +0100
@@ -518,8 +518,7 @@ tek_lib_visual_drawimage(lua_State *L)
TINT i, j;
TINT fmtcode;
TINT primcount, nump;
- lua_Number rect[4], minmax[4];
- lua_Number xoffs, yoffs;
+ lua_Number rect[4];
lua_Number scalex, scaley;
TEKVisual *vis = checkvisptr(L, 1);
TINT sx = vis->vis_ShiftX, sy = vis->vis_ShiftY;
@@ -540,24 +539,8 @@ tek_lib_visual_drawimage(lua_State *L)
lua_pop(L, 1);
/* s: */
- /* get minmax */
- lua_getfield(L, 2, "MinMax");
- luaL_checktype(L, -1, LUA_TTABLE);
-
- /* s: minmax */
- for (i = 0; i < 4; i++)
- {
- /* get s:minmax[i+1] */
- minmax[i] = igetnumber(L, -1, i+1);
- }
- lua_pop(L, 1);
- /* s: */
-
- xoffs = minmax[0];
- yoffs = minmax[1];
- scalex = (rect[2] - rect[0] + 1) * 0x10000 / ((minmax[2] - xoffs + 1) / 0x100);
- scaley = (rect[3] - rect[1] + 1) * 0x10000 / ((minmax[3] - yoffs + 1) / 0x100);
- /* scale: 8bit ffp */
+ scalex = rect[2] - rect[0];
+ scaley = rect[1] - rect[3];
/* get coordinates */
lua_getfield(L, 2, "Coords");
@@ -622,9 +605,9 @@ tek_lib_visual_drawimage(lua_State *L)
py = igetnumber(L, -4, pidx*2);
vis->vis_Drawdata.points[j*2] = rect[0] + sx +
- ((px - xoffs) / 0x100 * scalex + 0x7fff) / 0x10000;
- vis->vis_Drawdata.points[j*2+1] = rect[1] + sy +
- ((py - yoffs) / 0x100 * scaley + 0x7fff) / 0x10000;
+ (px * scalex + 0x7fff) / 0x10000;
+ vis->vis_Drawdata.points[j*2+1] = rect[3] + sy +
+ (py * scaley + 0x7fff) / 0x10000;
}
lua_pop(L, 1);
/* s: primitives[i+1], primitives, coords */
diff -r ce9ae4bc70fd -r 640f2d89245f tek/ui/class/checkmark.lua
--- a/tek/ui/class/checkmark.lua Fri Nov 14 14:59:33 2008 +0100
+++ b/tek/ui/class/checkmark.lua Fri Nov 14 18:10:42 2008 +0100
@@ -40,7 +40,7 @@ local max = math.max
local max = math.max
module("tek.ui.class.checkmark", tek.ui.class.text)
-_VERSION = "CheckMark 3.2"
+_VERSION = "CheckMark 3.3"
-------------------------------------------------------------------------------
-- Constants & Class data:
@@ -48,21 +48,20 @@ _VERSION = "CheckMark 3.2"
local coords =
{
- 0,0,
- -20,20,
- -30,10,
- 0,-20,
- 50,30,
- 40,40,
-
- -50,50,
- -40,40,
- 50,50,
- 40,40,
- 50,-50,
- 40,-40,
- -50,-50,
- -40,-40,
+ 0x8000, 0x8000,
+ 0x5555, 0xaaaa,
+ 0x4000, 0x9555,
+ 0x8000, 0x5555,
+ 0xeaaa, 0xc000,
+ 0xd555, 0xd555,
+ 0x1555, 0xeaaa,
+ 0x2aaa, 0xd555,
+ 0xeaaa, 0xeaaa,
+ 0xd555, 0xd555,
+ 0xeaaa, 0x1555,
+ 0xd555, 0x2aaa,
+ 0x1555, 0x1555,
+ 0x2aaa, 0x2aaa,
}
More information about the tekui-devel
mailing list