【 WindowTransformImage 】
格式:
WindowTransformImage(WindowName,
ImageId,
Left, Top,
Mode,
Mxx, Mxy, Myx, Myy)
中文:
WindowTransformImage(迷你視窗名稱,
圖片ID,
左端, 上端,
模式,
Mxx, Mxy, Myx, Myy)
說明:圖片複製到迷你視窗。可以設定有效的“矩陣”被對應到每個像素的位置,使得圖像可以旋轉,縮放,裁切,反轉和變形。
參數:
模式-修改圖像的方法:
值│說明 │Lua標記
│1 │完整複製。 │miniwin.image_copy │
│2 │無 │ │
│3 │不複製與左上角(像素位置0,0) │ miniwin.image_transparent_copy │
│ │的像素相同的顏色。 │ │
└─┴───────────────┴────────────────┘
每個目標像素的位置( X'和Y ' )由下式得值:
x' = (x * Mxx) + (y * Mxy) + Left
y' = (x * Myx) + (y * Myy) + Top
MXX:用來乘以舊X向量值給新X向量值。
MXY:用來乘以舊Y向量值給新X向量值。
MYX:用來乘以舊X向量值給新Y向量值。
MYY:用來乘以舊Y向量值給新Y向量值。
以下是程式作者提供的參數表:
動作 │ Mxx Mxy Myx Myy
│Identity (copy) │ 1 0 0 1 │
│Reflection on X │ -1 0 0 1 │
│Reflection on Y │ 1 0 0 -1 │
│Reflection on both │ -1 0 0 -1 │
│Rotation clockwise │ cosine -sine sine cosine │
│Rotation counter clockwise │ cosine sine -sine cosine │
│Shear vertically RH side down │ 1 0 1 1 │
│Shear vertically RH side up │ 1 0 -1 1 │
│Shear horizontally bottom to right│ 1 1 0 1 │
│Shear horizontally bottom to left │ 1 -1 0 1 │
│Scale by 1.5 (larger) │ 1.5 0 0 1.5 │
│Scale by 0.5 (smaller) │ 0.5 0 0 0.5 │
└─────────────────┴────────────────┘
範例:
--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--
-- IDENTITY COPY (ie. copy without changing)
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 1, 0, 0, 1)
-- TRANSLATE
-- move in X direction
WindowTransformImage (win, imageid, 100, 0, miniwin.image_copy, 1, 0, 0, 1)
-- move in Y direction
WindowTransformImage (win, imageid, 0, 100, miniwin.image_copy, 1, 0, 0, 1)
-- REFLECT ON THE X AXIS
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, -1, 0, 0, 1)
-- REFLECT ON THE Y AXIS
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 1, 0, 0, -1)
-- REFLECT ON BOTH AXES (ROTATE 180 DEGREES)
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, -1, 0, 0, -1)
-- ROTATE
-- rotation angle in degrees
local angle = 30
-- angle converted to radians
local radians = math.rad (angle)
-- calculate sine and cosine
local sine = math.sin (radians)
local cosine = math.cos (radians)
-- rotate counterclockwise
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy,
cosine, sine, -sine, cosine)
-- rotate clockwise
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy,
cosine, -sine, sine, cosine)
-- shear vertically right side downwards
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 1, 0, 1, 1)
-- shear horizontally, bottom to the right
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 1, 0.5, 0, 1)
-- SCALE
-- make 1.5 times larger
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 1.5, 0, 0, 1.5)
-- reduce to 50%
WindowTransformImage (win, imageid, 0, 0, miniwin.image_copy, 0.5, 0, 0, 0.5)
--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--==-==--
來源:來源:http://www.gammon.com.au/mushclient/mw_images.htm#WindowFilter