Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » TopWindow content to image
TopWindow content to image [message #26511] |
Fri, 07 May 2010 10:53  |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
Hello,
how to get the content of the TopWindow after whole refreshing to image? (mainly for printing purposes)
topwindow has only custom image-ctrls with many alpha images in it
thank you.
|
|
|
|
Re: TopWindow content to image [message #26519 is a reply to message #26518] |
Fri, 07 May 2010 16:02   |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
thank you for reply.
printing: yes, I've did it like that. I am drawing something in the paint routine and something somewhere else.
the stuff in paint routine for printing is(there was need for some scaling etc.)
other visual stuff is broke.
1. I have custom image-ctrls, which I am adding to screen, moving with them, they are composed of some alpha images, I can move with them, works fine.
2. in paint routine, the only thing I am doing, is setting rectangle for every of these images apparent to their size and possition.
3. I am calling timer(20 per sec) to call some needed stuff and there is also a Refresh()
When the event to print comes to scene, all the custom (the only at all) image-ctrls(have just one type) is situated in one place in lefttop.
I will try to put here some shortened example.
nice week
[Updated on: Fri, 07 May 2010 19:04] Report message to a moderator
|
|
|
Re: TopWindow content to image [message #26530 is a reply to message #26519] |
Mon, 10 May 2010 08:01   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
qwerty wrote on Fri, 07 May 2010 10:02 | thank you for reply.
printing: yes, I've did it like that. I am drawing something in the paint routine and something somewhere else.
the stuff in paint routine for printing is(there was need for some scaling etc.)
other visual stuff is broke.
1. I have custom image-ctrls, which I am adding to screen, moving with them, they are composed of some alpha images, I can move with them, works fine.
2. in paint routine, the only thing I am doing, is setting rectangle for every of these images apparent to their size and possition.
3. I am calling timer(20 per sec) to call some needed stuff and there is also a Refresh()
When the event to print comes to scene, all the custom (the only at all) image-ctrls(have just one type) is situated in one place in lefttop.
I will try to put here some shortened example.
nice week
|
OK. Well, generally, it can be a bit tricky to print widgets. But I will wait for the example 
Mirek
|
|
|
Re: TopWindow content to image [message #26533 is a reply to message #26530] |
Mon, 10 May 2010 10:46   |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
class SegImage_t {
public:
Image img;
...
SegImage_t(String fn, byte B_) : B(B_) {
...
img = StreamRaster::LoadFileAny(~fn);
...
}
};
class SegItem : public Ctrl {
typedef SegItem CLASSNAME;
WithPropsLay<TopWindow> propsWin;
public:
q* owner;
...
Array<SegImage_t> segs;
SegItem(String fn, int id, q* owner);
...
void Paint(Draw& w) {
...
w.DrawImage(GetSize(), back);
for(int i = 0; i < segs.GetCount(); ++i) {
w.DrawImage(GetSize(), segs[i].img);
}
...
};
class q : public TopWindow {
private:
typedef q CLASSNAME;
WithOptLay<TopWindow> optWin;
public:
Array<SegItem> segitems;
SegItem* segitem;
...
void Paint(Draw& w) {
paint(w);
}
paint(Draw& w) {
w.DrawRect(GetSize(), Black);
...
for(int s = 0; s < segitem.segs.GetCount(); ++s) {
segitem.SetRect(
x, y,
segitem.segs[s].img.GetWidth (),
segitem.segs[s].img.GetHeight()
);
...
}
void rs32Proc() {
...
Refresh();
}
Print() {
// ...simplified...
PrinterJob pj;
pj.Landscape();
Draw& w = pj;
w.StartPage();
paint(w);
w.EndPage();
}
q() {
...
SetTimeCallback(REFRESH_TIME, THISBACK(rs232Proc));
}
};
when I try to print it, all the SegItems is in left-top corner. In real, they have differrent coordinates. Can make some custom print routine, but why to separate? 
thank you
[Updated on: Mon, 10 May 2010 10:47] Report message to a moderator
|
|
|
|
Re: TopWindow content to image [message #26537 is a reply to message #26535] |
Mon, 10 May 2010 12:00   |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
I am sorry, but about coordinates I am not. I must experimenting every time.
thing about printing/viewing. just to take screenshot... how about that? and then simply scale and send to printer... ?
thoughts is twisting about the idea of own rutine to check and scale screen to fit the page automatically btw.
you are telling, that the printing ctrls is tricky...
how it should be right? (if it even could be)
the array of Added(SegItem)s ctrls is the only I have created and using.
I will attach the whole project, if it helps, but it's 'big'
ps: I had copied the code only relevant to ctrls, everything else is about background stuff etc. nothing to do w/ visuals
pps: I was thinking about 'catch' the block of memory somewhere which has to be printed to videobuffer and dump it
[Updated on: Mon, 10 May 2010 12:19] Report message to a moderator
|
|
|
|
|
|
Re: TopWindow content to image [message #26659 is a reply to message #26595] |
Tue, 18 May 2010 11:23  |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
hello again.
I will freeze this topic for now. I am going to finish other tasks to use the program(because it's needed) and topic here discused later.
hope I don't upset you.
thank you very much
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:02:54 CEST 2025
Total time taken to generate the page: 0.01152 seconds
|