Colors: How To?
-
Hi, I have a vanilla SDI app with a scroll view in it. I have also created a CWnd derived window intended to be used as a child window in a dialog etc to pick colors from. It is populated with about 400 colors obtained from a 3rd party source. All drawing seems to be OK, apart from: I choose a color in my derived child window, then click in the SDI view to 'draw with it' and the colors don't match up. I'm not sure if the view or the child window is drawing the colors wrong (hopefully not both as the colors are different!). I did put the RGB value of one color into Paint SHop Pro and it corresponded to the view, so I think the view is right. Is there anything you have to do to get a window (my derived child window) to have the same color depth as the view? Or is something else amiss? Thanks in advance, Simon :confused:
-
Hi, I have a vanilla SDI app with a scroll view in it. I have also created a CWnd derived window intended to be used as a child window in a dialog etc to pick colors from. It is populated with about 400 colors obtained from a 3rd party source. All drawing seems to be OK, apart from: I choose a color in my derived child window, then click in the SDI view to 'draw with it' and the colors don't match up. I'm not sure if the view or the child window is drawing the colors wrong (hopefully not both as the colors are different!). I did put the RGB value of one color into Paint SHop Pro and it corresponded to the view, so I think the view is right. Is there anything you have to do to get a window (my derived child window) to have the same color depth as the view? Or is something else amiss? Thanks in advance, Simon :confused:
If you've managed to make different parts of your screen the same colour depth then I salute you. You may have a DIBSection that you are drawing on, and it may be any colour depth, so check that first - if it's 8 bit then there's your problem right there. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
-
If you've managed to make different parts of your screen the same colour depth then I salute you. You may have a DIBSection that you are drawing on, and it may be any colour depth, so check that first - if it's 8 bit then there's your problem right there. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
Christian, Thanks for the response. To be honest, I think there is a problem with the CDC that I am given. I simply pass it to the render function that creates a compatible dc with a compatible bitmap attached to it. I do this because I am drawing the state off-screen for flicker-free drawing. I will try drawing direct to the given DC, but I don't feel this will help at all. Is there anywhere that you can influence the color depth of a window's DC at creation or after? Simon
-
Hi, I have a vanilla SDI app with a scroll view in it. I have also created a CWnd derived window intended to be used as a child window in a dialog etc to pick colors from. It is populated with about 400 colors obtained from a 3rd party source. All drawing seems to be OK, apart from: I choose a color in my derived child window, then click in the SDI view to 'draw with it' and the colors don't match up. I'm not sure if the view or the child window is drawing the colors wrong (hopefully not both as the colors are different!). I did put the RGB value of one color into Paint SHop Pro and it corresponded to the view, so I think the view is right. Is there anything you have to do to get a window (my derived child window) to have the same color depth as the view? Or is something else amiss? Thanks in advance, Simon :confused:
Hmmm, most interesting. In case anyone was interested, I have overcome the problem, but storing the color not as 3 bytes, but as a COLORREF structure. I am slightly confused, since I thought all the COLORREF structure was is 3 byte values, but if it works, I ain't going to kick it! :laugh: Simon
-
Hmmm, most interesting. In case anyone was interested, I have overcome the problem, but storing the color not as 3 bytes, but as a COLORREF structure. I am slightly confused, since I thought all the COLORREF structure was is 3 byte values, but if it works, I ain't going to kick it! :laugh: Simon
The problem was obviously in converting the COLORREF to unsigned char values, because that is all they are in the COLORREF Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
-
Hi, I have a vanilla SDI app with a scroll view in it. I have also created a CWnd derived window intended to be used as a child window in a dialog etc to pick colors from. It is populated with about 400 colors obtained from a 3rd party source. All drawing seems to be OK, apart from: I choose a color in my derived child window, then click in the SDI view to 'draw with it' and the colors don't match up. I'm not sure if the view or the child window is drawing the colors wrong (hopefully not both as the colors are different!). I did put the RGB value of one color into Paint SHop Pro and it corresponded to the view, so I think the view is right. Is there anything you have to do to get a window (my derived child window) to have the same color depth as the view? Or is something else amiss? Thanks in advance, Simon :confused:
Soup, while not having an answer as to why the two colours don't match up I do have this link for you. Try Color Picker, it's free and will show the RGB values for any area of the screen that is under the cursor. Should make it a bit easier than copying into Paint Shop Pro. Michael Martin Australia mjm68@tpg.com.au "Don't belong. Never join. Think for yourself. Peace" - Victor Stone
-
Hi, I have a vanilla SDI app with a scroll view in it. I have also created a CWnd derived window intended to be used as a child window in a dialog etc to pick colors from. It is populated with about 400 colors obtained from a 3rd party source. All drawing seems to be OK, apart from: I choose a color in my derived child window, then click in the SDI view to 'draw with it' and the colors don't match up. I'm not sure if the view or the child window is drawing the colors wrong (hopefully not both as the colors are different!). I did put the RGB value of one color into Paint SHop Pro and it corresponded to the view, so I think the view is right. Is there anything you have to do to get a window (my derived child window) to have the same color depth as the view? Or is something else amiss? Thanks in advance, Simon :confused: