Posted: Wed Feb 11, 2015 7:27 pm Post subject: Drawing forms contents.
I have a form and inside of it a panel with massive width (that has lot's of objects).
I'm trying to copy the 'offscreen' content of the form&panel and draw it into an image (in another form).
I'm not quite sure how the function printToRasterImage works, as it draws for me a black rect (even when using in visible area).
Let's say I have this object
Code:
app = {}
app.init = function()
local self = app;
self.form = createForm();
self.form.width = 600;
self.form.height = 450;
self.panel = createPanel(self.form);
self.panel.width = 1800;
self.panel.height = 450;
local lastcol = 0;
local color = 0;
local clrs = {0x1186b6,0x2dbdf3,0xefa210,0x9d20dd,0x443dc8,0x2b6905,0x1843eb}
local mf,mr = math.floor,math.random
for i=1,25 do
local obj = createImage(self.panel);
obj.left = 5 + mf(self.panel.width / 25)*(i-1);
obj.top = mf(self.panel.height/2);
obj.Canvas.Brush.Color = (function () while color==lastcol do color = clrs[mr(1,7)] end lastcol = color return color end)();
obj.Canvas.fillRect(0,0,obj.width,obj.height);
end
end
app.init();
And I want to draw offscreen (600-1200) do the image object below
Code:
f = createForm();
i = createImage(f);
i.width = f.width;
i.height = f.height;
Without recreating the objects (huge performance impact). _________________
I'm rusty and getting older, help me re-learn lua.
i'm not sure that's possible, if it's not visible it won't get rendered(painted)
why not use a different design? e. g. create that second form from the start and fill that with the extra controls insteads
I'm working on some side fun project.
Thing is, lot's of objects being created which cause heavy performance, so I'm trying to clone part of main window (creating like a preview), which shouldn't use too much resources (as there is no need to mix 4 or images into 1 object and change pixelformat). _________________
I'm rusty and getting older, help me re-learn lua.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum