|
|
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » DrawImage with XOR undefined
DrawImage with XOR undefined [message #9067] |
Mon, 16 April 2007 15:15 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
I am currently trying to use the following function from the help
Quote: |
enum { EFFECT_MASK, STANDARD, GRAYED, ETCHED, XOR }
EFFECT_MASK bit mask covering all values of supported drawing effects
STANDARD Displays the image with its usual colors.
GRAYED Draws a grayed image, i.e. discards color information.
ETCHED Draws an 'etched' image outline (used e.g. in toolbars to mark 'disabled' buttons).
XOR Draws the image using the XOR bitwise operator. This is sometimes used for drag & drop where, during dragging, the desired image is being repeatedly displayed and removed using the same logical operation.
void DrawImage(const Rect& rect, const Image& img, int fx = 0)
Draws the whole image img into the rectangle rect relative to current coordinate origin.
rect Destination (output) rectangle (relative to current origin)
img Image to draw at the specified location.
fx Special drawing effects (see above).
|
I want to do exactly what it describes for drag and drop using XOR but when I compile I get XOR undefined. Is there something wrong with this please?
w.DrawImage(rc1,m_image,XOR);
w.DrawImage(rc2,m_image,XOR);
Any help much appreciated.
Thanks,
Nick
p.s. I searched the upp/src for the terms XOR and ETCHED and got no hits apart from one comment. If the documentation is out of date, can anyone tell me what the current best way to do this is because I've looked through all the examples and reference and cannot find anything.
[Updated on: Mon, 16 April 2007 16:35] Report message to a moderator
|
|
|
Re: DrawImage with XOR undefined [message #9070 is a reply to message #9067] |
Mon, 16 April 2007 17:39 |
|
mirek
Messages: 14195 Registered: November 2005
|
Ultimate Member |
|
|
nixnixnix wrote on Mon, 16 April 2007 09:15 | I am currently trying to use the following function from the help
Quote: |
enum { EFFECT_MASK, STANDARD, GRAYED, ETCHED, XOR }
EFFECT_MASK bit mask covering all values of supported drawing effects
STANDARD Displays the image with its usual colors.
GRAYED Draws a grayed image, i.e. discards color information.
ETCHED Draws an 'etched' image outline (used e.g. in toolbars to mark 'disabled' buttons).
XOR Draws the image using the XOR bitwise operator. This is sometimes used for drag & drop where, during dragging, the desired image is being repeatedly displayed and removed using the same logical operation.
void DrawImage(const Rect& rect, const Image& img, int fx = 0)
Draws the whole image img into the rectangle rect relative to current coordinate origin.
rect Destination (output) rectangle (relative to current origin)
img Image to draw at the specified location.
fx Special drawing effects (see above).
|
I want to do exactly what it describes for drag and drop using XOR but when I compile I get XOR undefined. Is there something wrong with this please?
w.DrawImage(rc1,m_image,XOR);
w.DrawImage(rc2,m_image,XOR);
Any help much appreciated.
Thanks,
Nick
p.s. I searched the upp/src for the terms XOR and ETCHED and got no hits apart from one comment. If the documentation is out of date, can anyone tell me what the current best way to do this is because I've looked through all the examples and reference and cannot find anything.
|
Sorry, obsolete documentation. Image was changed last year and required support of alpha chanel essentialy made these impossible...
Mirek
|
|
|
|
|
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
|
|
|
|
|
Re: DrawImage with XOR undefined [message #9114 is a reply to message #9109] |
Wed, 18 April 2007 05:07 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
hmmm, I tried a callback to see if it was executed after the refresh but no luck.
Is the GetLineCount crash a bug or is it just my improper use of the function? I only ask because you have implied that I should be able to get run through the TreeCtrl's nodes and get them to redraw themselves but in order to do this I need to call GetLineCount
If there was a way of telling TreeCtrl to paint itself and all its nodes then this part of my puzzle would be over.
Cheers,
Nick
[Updated on: Wed, 18 April 2007 05:22] Report message to a moderator
|
|
|
|
Re: DrawImage with XOR undefined [message #9134 is a reply to message #9120] |
Wed, 18 April 2007 16:35 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Thanks again Mirek,
I'll try keeping a list of the Nodes so I can access their ctrls and tell them to draw and if that doesnt work I'll try the popup window. After all this I now have a more general question but I'll start a new thread.
Cheers and thanks for helping me work through this,
Nick
|
|
|
Goto Forum:
Current Time: Sun Jan 19 04:31:15 CET 2025
Total time taken to generate the page: 0.02974 seconds
|
|
|