1. wxEuphoria - color_selector()
- Posted by Jerry Story <jstory at ocii.com> Sep 24, 2006
- 627 views
- Last edited Sep 25, 2006
atom red,green,blue,skin red = 255 green = 200 blue = 100 skin = create(wxColour,{red,green,blue})
Later I change skin with color_selector(). That works but there seems to be no way to save the color to a file. Saving skin to file does not produce a consistent result. That is, set_back_color(Win, skin) works, but when skin is saved to a file, and then the program is stopped and restarted and it reads skin, set_back_color(Win, skin) doesn't work. Unless there is a bug in the way I'm doing it. Also there seems to be no way to derive red,green,blue from skin. That would be ideal. Then the ini file could be edited. How can a color from color_selector() be saved to a file?
2. Re: wxEuphoria - color_selector()
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 24, 2006
- 613 views
- Last edited Sep 25, 2006
Jerry Story wrote: > > }}} <eucode> > atom red,green,blue,skin > red = 255 > green = 200 > blue = 100 > skin = create(wxColour,{red,green,blue}) > </eucode> {{{ > > Later I change skin with color_selector(). > That works but there seems to be no way to save the color to a file. > > Saving skin to file does not produce a consistent result. > That is, set_back_color(Win, skin) works, > but when skin is saved to a file, and then the program is stopped and > restarted > and it reads skin, > set_back_color(Win, skin) doesn't work. > Unless there is a bug in the way I'm doing it. > > Also there seems to be no way to derive red,green,blue from skin. That would > be ideal. Then the ini file could be edited. > > How can a color from color_selector() be saved to a file? I don't use wxEuphoria but I do use XColors in Xmotor, I think you'll find that skin is a pointer the structure that contains your color. So when the program ends that pointer is no longer valid. You will probably have to save the three color values in an ini file. Then when your program starts do a skin = create(wxColour,{red,green,blue}) Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
3. Re: wxEuphoria - color_selector()
- Posted by Jerry Story <jstory at ocii.com> Sep 25, 2006
- 627 views
Bernie Ryan wrote: > You will probably have to save the three color values in an ini file. > > Then when your program starts do a > skin = create(wxColour,{red,green,blue}) The question boils down to: how to get the 3 colors from color_selector()?
4. Re: wxEuphoria - color_selector()
- Posted by Jesse Adkins <Tassadar29 at lycos.com> Sep 25, 2006
- 622 views
Jerry Story wrote: > > Bernie Ryan wrote: > > You will probably have to save the three color values in an ini file. > > > > Then when your program starts do a > > skin = create(wxColour,{red,green,blue}) > > The question boils down to: > how to get the 3 colors from color_selector()? Instead of trying to get the value from the color selector, why not try grabbing the values of the colors since they're easier to work with? Something like printf might work for what you're trying to do. printf ( FILE, "%d,%d,%d", {Red,Green,Blue}) Hope that helps.
5. Re: wxEuphoria - color_selector()
- Posted by Jerry Story <jstory at ocii.com> Sep 25, 2006
- 631 views
Jesse Adkins wrote: > > Jerry Story wrote: > > > > Bernie Ryan wrote: > > > You will probably have to save the three color values in an ini file. > > > > > > Then when your program starts do a > > > skin = create(wxColour,{red,green,blue}) > > > > The question boils down to: > > how to get the 3 colors from color_selector()? > > Instead of trying to get the value from the color selector, why not try > grabbing the values of the colors since they're easier to work with? > > Something like printf might work for what you're trying to do. > > printf ( FILE, "%d,%d,%d", {Red,Green,Blue}) > > Hope that helps. How do I get red,green,blue? I know how to do everything else.
6. Re: wxEuphoria - color_selector()
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 25, 2006
- 619 views
Jerry Story wrote: > > Jesse Adkins wrote: > > > > Jerry Story wrote: > > > > > > Bernie Ryan wrote: > > > > You will probably have to save the three color values in an ini file. > > > > > > > > Then when your program starts do a > > > > skin = create(wxColour,{red,green,blue}) > > > > > > The question boils down to: > > > how to get the 3 colors from color_selector()? > > > > Instead of trying to get the value from the color selector, why not try > > grabbing the values of the colors since they're easier to work with? > > > > Something like printf might work for what you're trying to do. > > > > printf ( FILE, "%d,%d,%d", {Red,Green,Blue}) > > > > Hope that helps. > > How do I get red,green,blue? > I know how to do everything else. From the win32lib library ... ----------------------------------------------------------------------------- --/topic Graphics --/func split_rgb( object pColor) --/desc Convert a color into a {red, green, blue}. --/ret Sequence: 3-element {RED, GREEN, BLUE} -- Converts the color value into its component colors. -- -- Example: -- /code -- -- get the colors got a pixel -- RGB = split_rgb( getPixel(myBMP, 4,7) ) -- RGB = split_rgb( "BrightCyan" ) -- RGB = split_rgb( COLOR_BUTTONFACE ) -- RGB = split_rgb( Magenta ) -- /endcode atom gColors gColors = allocate_mem(4) global function split_rgb( object pColor ) poke4(gColors, colorValue(pColor)) return peek({gColors,3}) end function -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
7. Re: wxEuphoria - color_selector()
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Sep 25, 2006
- 622 views
Jerry Story wrote: > > }}} <eucode> > atom red,green,blue,skin > red = 255 > green = 200 > blue = 100 > skin = create(wxColour,{red,green,blue}) > </eucode> {{{ > > Later I change skin with color_selector(). > That works but there seems to be no way to save the color to a file. > > Saving skin to file does not produce a consistent result. > That is, set_back_color(Win, skin) works, > but when skin is saved to a file, and then the program is stopped and > restarted > and it reads skin, > set_back_color(Win, skin) doesn't work. > Unless there is a bug in the way I'm doing it. > > Also there seems to be no way to derive red,green,blue from skin. That would > be ideal. Then the ini file could be edited. > > How can a color from color_selector() be saved to a file? You can use these functions to get the color components:
--/topic wxColour --/func get_red( atom color ) -- --Returns the red intensity of a wxColour. global function get_red( atom color ) return and_bits(call_member( wxColour_Red, color, {} ), #FF) end function --/topic wxColour --/func get_green( atom color ) -- --Returns the green intensity of a wxColour. global function get_green( atom color ) return and_bits(call_member( wxColour_Green, color, {} ), #FF) end function --/topic wxColour --/func get_blue( atom color ) -- --Returns the blue intensity of a wxColour. global function get_blue( atom color ) return and_bits(call_member( wxColour_Blue, color, {} ), #FF) end function
Matt Lewis
8. Re: wxEuphoria - color_selector()
- Posted by Jerry Story <jstory at ocii.com> Sep 25, 2006
- 648 views
Matt Lewis wrote: > You can use these functions to get the color components: > > }}} <eucode> > --/topic wxColour > --/func get_red( atom color ) > -- > --Returns the red intensity of a wxColour. > global function get_red( atom color ) > return and_bits(call_member( wxColour_Red, color, {} ), #FF) > end function > > --/topic wxColour > --/func get_green( atom color ) > -- > --Returns the green intensity of a wxColour. > global function get_green( atom color ) > return and_bits(call_member( wxColour_Green, color, {} ), #FF) > end function > > --/topic wxColour > --/func get_blue( atom color ) > -- > --Returns the blue intensity of a wxColour. > global function get_blue( atom color ) > return and_bits(call_member( wxColour_Blue, color, {} ), #FF) > end function > </eucode> {{{ Thanks. It works.