Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » DrawImage with XOR undefined
Re: DrawImage with XOR undefined [message #9108 is a reply to message #9086] |
Tue, 17 April 2007 21:20   |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
I am using RectTracker to grab a node from a TreeCtrl and drag it onto another node in order to change the tree hierarchy.
I've subclassed from RectTracker and overwritten its DrawRect routine. My only problem is that I erase the background so I need to sample it and replace it. I've tried the following approaches:
1) I can get the TreeCtrl to repaint itself but TreeCtrl::GetLineCount() falls over when I'm in the local loop so I can't ask the nodes to repaint themselves.
2) I tried refresh but it gets carried out after I draw the dragged image so even though I only refresh the rect containing the old position of the dragged node (i.e. rc1), it still erases most of the dragged node. If there was a way to refresh a rect minus another rect that would work (clipping?).
3) If I could do this by sampling the screen, I would be able to apply this method to other views in which a refresh takes a long time. However my attempts to sample the screen are so far not successful. See below:
void LayerTracker::DrawRect(Rect rc1,Rect rc2)
{
ViewDraw w(&GetMaster());
w.DrawImage(rc1,m_screen);
// sample screen at rc2
ImageBuffer ib(rc2.Size());
ImageBuffer buf = w;
for(int i=0;i<rc2.Height();i++)
{
RGBA* pS = buf[rc2.top+i];
RGBA* pB = ib[rc2.top+i];
memcpy(pB,pS,rc2.Width());
}
m_screen = ib;
w.DrawImage(rc2,m_image);
}
m_image and m_screen are or type Image. My problem is there is no conversion from ViewDraw to Image. Ideally I would use a function of this form
Image ViewDraw::GetImage(Rect rcSample)
Is there a way to sample screen pixels at present?
Nick
[Updated on: Tue, 17 April 2007 22:17] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Jul 02 02:38:51 CEST 2025
Total time taken to generate the page: 0.03882 seconds
|