-- a bitmap of 200 by 100 pixels, opaque white, that fills the whole page it is put on b1 = BitMap.New(200, 100) -- a bitmap of 20 by 20 pixels, half transparent red, from (0.1, 0.2) to (0.5, 0.8) of the page b2 = BitMap.New(20, 20, {{"Canvas.Origin.X",0.1}, {"Canvas.Origin.Y",0.2}, {"Canvas.Size.X",0.4}, {"Canvas.Size.Y",0.6}, {"Color",0x80FF0000}}) -- the same in blue, made half transparent by the opacity alpha, from (0.3, 0.1) to (0.9, 0.5) b3 = BitMap.New(20, 20, {{"Canvas.Origin.X",0.3}, {"Canvas.Origin.Y",0.1}, {"Canvas.Size.X",0.6}, {"Canvas.Size.Y",0.4}, {"Color",0x0000FF}, {"alpha",128}}) -- put them on a page and look at what is there: the corners and the color of the first pixel pl = Graphics.New() pl.Add(b1) pl.Add(b2) pl.Add(b3) for k, B in ipairs(Graphics.ToTable(pl).BitMap) do print(string.format("bitmap %d: %3d by %3d pixels from (%.1f, %.1f) to (%.1f, %.1f), first pixel 0x%s", k, B.NpointsX, B.NpointsY, B.LB[1], B.LB[2], B.RT[1], B.RT[2], string.sub(B.Pixels, 1, 8))) end file = io.open("BitMap_New.svg", "w") file:write(Graphics.ToSVG(pl, {{"RelativeSize",true}})) file:close()