diff options
author | scuri <scuri> | 2009-10-27 19:38:37 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-10-27 19:38:37 +0000 |
commit | d74811ae84f8caebf287eb2fd4cc799fc7dbcee2 (patch) | |
tree | 6deaddfd02831020014a163b4bdc251d21b1ac9a /html | |
parent | bc2a19199ee23eb9c416c8bc4a5553ca3828f8f0 (diff) |
*** empty log message ***
Diffstat (limited to 'html')
-rw-r--r-- | html/examples/render_cd_bgalpha.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/html/examples/render_cd_bgalpha.lua b/html/examples/render_cd_bgalpha.lua new file mode 100644 index 0000000..3cbcff9 --- /dev/null +++ b/html/examples/render_cd_bgalpha.lua @@ -0,0 +1,27 @@ +require"imlua" +require"cdlua" +require"cdluaim" + +local image = im.ImageCreate(500, 500, im.RGB, im.BYTE) +image:AddAlpha() +local canvas = image:cdCreateCanvas() -- Creates a CD_IMAGERGB canvas + +canvas:Activate() + +-- Use SetBackground instead of Background to avoid conflict with cd.QUERY +canvas:SetBackground(cd.EncodeAlpha(cd.EncodeColor(255, 255, 255), 0)) -- full transparent white +canvas:Clear() + +fgcolor = cd.EncodeAlpha(cd.EncodeColor(255, 0, 0), 50) -- semi transparent red +canvas:Foreground(fgcolor) +canvas:Font("Times", cd.BOLD, 24) +canvas:Text(100, 100, "Test") +canvas:Line(0,0,100,100) + +fgcolor = cd.EncodeColor(0, 0, 255) +canvas:Foreground(fgcolor) +canvas:Line(0,50,150,50) + +canvas:Kill() + +image:Save("new.png", "PNG") |