# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # # C2S_NAME = 1 # # C2S_CSS_SYNTAX = 2 # # C2S_HTML_SYNTAX = 4 # # ALPHA_TRANSPARENT = 0 # # ALPHA_OPAQUE = 255 # # NULL_COLOUR = nil # Converts string to a {Wx::Colour} best represented by the given string. # Returns true on success. # # Include file: #include # @see wxToString(const wxColour&) # @param string [String] # @param colour [Wx::Colour] # @return [true,false] def self.from_string(string, colour) end # Converts the given {Wx::Colour} into a string. # Include file: #include # @see wxFromString(const wxString& # @see wxColour*) # @param colour [Wx::Colour,String,Symbol] # @return [String] def self.to_string(colour) end # A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values and an Alpha value, and is used to determine drawing colours. # See the entry for {Wx::ColourDatabase} for how a pointer to a predefined, named colour may be returned instead of creating a new colour. # Valid RGB values are in the range 0 to 255. # You can retrieve the current system colour settings with {Wx::SystemSettings}. # # == Channel Accessor Functions # # Note that this class provides pairs of functions for each of the colour channels, i.e. red, green, blue and alpha values. The one word functions {Wx::Colour#red}, {Wx::Colour#green}, {Wx::Colour#blue} and {Wx::Colour#alpha} return the values of type unsigned char, while {Wx::Colour#get_red}, {Wx::Colour#get_green}, {Wx::Colour#get_blue} and {Wx::Colour#get_alpha} returns the same value as unsigned int. According to the C++ integer promotion rules, the result of any arithmetic expression involving the former will be (signed) int, while that of the latter will be unsigned, which is what would be commonly expected, so the latter family of functions should be typically preferred (but they are only available since wxWidgets 3.1.6). # === # # Category: Graphics Device Interface (GDI) # Predefined objects/pointers: # - {Wx::NULL_COLOUR} - An empty, invalid colour.- {Wx::TransparentColour} - Valid but fully transparent colour (new in 2.9.1).- {Wx::BLACK}- {Wx::BLUE}- {Wx::CYAN}- {Wx::GREEN}- {Wx::YELLOW}- {Wx::LIGHT_GREY}- {Wx::RED}- {Wx::WHITE} # @see Wx::ColourDatabase # @see Wx::Pen # @see Wx::Brush # @see Wx::ColourDialog # @see Wx::SystemSettings # # class Colour < Object # Sets the RGB or RGBA colour values from a single 32 bit value. # The arguments colRGB and colRGBA should be of the form 0x00BBGGRR and 0xAABBGGRR respectively where 0xRR, 0xGG, 0xBB and 0xAA are the values of the red, green, blue and alpha components. # Notice the right-to-left order of components! # @see Wx::Colour#get_rgb # @see Wx::Colour#get_rgba # @param colRGB [Integer] # @return [void] def set_rgb(colRGB) end alias_method :rgb=, :set_rgb # Sets the RGB or RGBA colour values from a single 32 bit value. # The arguments colRGB and colRGBA should be of the form 0x00BBGGRR and 0xAABBGGRR respectively where 0xRR, 0xGG, 0xBB and 0xAA are the values of the red, green, blue and alpha components. # Notice the right-to-left order of components! # @see Wx::Colour#get_rgb # @see Wx::Colour#get_rgba # @param colRGBA [Integer] # @return [void] def set_rgba(colRGBA) end alias_method :rgba=, :set_rgba # Gets the RGB or RGBA colour values as a single 32 bit value. # The returned value is of the same form as expected by {Wx::Colour#set_rgb} and {Wx::Colour#set_rgba}. # Notice that {Wx::Colour#get_rgb} returns the value with 0 as its highest byte independently of the value actually returned by {Wx::Colour#alpha}. So for a fully opaque colour, the return value of {Wx::Colour#get_rgba} is 0xFFBBGGRR while that of {Wx::Colour#get_rgb} is 0x00BBGGRR. # @return [Integer] def get_rgb; end alias_method :rgb, :get_rgb # Gets the RGB or RGBA colour values as a single 32 bit value. # The returned value is of the same form as expected by {Wx::Colour#set_rgb} and {Wx::Colour#set_rgba}. # Notice that {Wx::Colour#get_rgb} returns the value with 0 as its highest byte independently of the value actually returned by {Wx::Colour#alpha}. So for a fully opaque colour, the return value of {Wx::Colour#get_rgba} is 0xFFBBGGRR while that of {Wx::Colour#get_rgb} is 0x00BBGGRR. # @return [Integer] def get_rgba; end alias_method :rgba, :get_rgba # @overload set(red, green, blue, alpha=Wx::ALPHA_OPAQUE) # Sets the RGB intensity values using the given values (first overload), extracting them from the packed long (second overload), using the given string (third overload). # When using third form, {Wx::Colour#set} accepts: colour names (those listed in {Wx::ColourDatabase}), the CSS-like "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (case insensitive) and the HTML-like syntax: "#" followed by 6 hexadecimal digits for red, green, blue components. # Returns true if the conversion was successful, false otherwise. # @param red [Integer] # @param green [Integer] # @param blue [Integer] # @param alpha [Integer] # @return [void] # @overload set(RGB) # Sets the RGB intensity values using the given values (first overload), extracting them from the packed long (second overload), using the given string (third overload). # When using third form, {Wx::Colour#set} accepts: colour names (those listed in {Wx::ColourDatabase}), the CSS-like "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (case insensitive) and the HTML-like syntax: "#" followed by 6 hexadecimal digits for red, green, blue components. # Returns true if the conversion was successful, false otherwise. # @param RGB [Integer] # @return [void] # @overload set(str) # Sets the RGB intensity values using the given values (first overload), extracting them from the packed long (second overload), using the given string (third overload). # When using third form, {Wx::Colour#set} accepts: colour names (those listed in {Wx::ColourDatabase}), the CSS-like "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (case insensitive) and the HTML-like syntax: "#" followed by 6 hexadecimal digits for red, green, blue components. # Returns true if the conversion was successful, false otherwise. # @param str [String] # @return [true,false] def set(*args) end # @overload initialize() # Default constructor. # @return [Colour] # @overload initialize(red, green, blue, alpha=Wx::ALPHA_OPAQUE) # @param red [Integer] The red value. # @param green [Integer] The green value. # @param blue [Integer] The blue value. # @param alpha [Integer] The alpha value. Alpha values range from 0 ({Wx::ALPHA_TRANSPARENT}) to 255 ({Wx::ALPHA_OPAQUE}). # @return [Colour] # @overload initialize(colourName) # @param colourName [String] The colour name. # @return [Colour] # @overload initialize(colRGB) # @param colRGB [Integer] A packed RGB value. # @return [Colour] # @overload initialize(colour) # Copy constructor. # @param colour [Wx::Colour,String,Symbol] # @return [Colour] def initialize(*args) end # Returns the alpha value, on platforms where alpha is not yet supported, this always returns {Wx::ALPHA_OPAQUE}. # # @see Wx::Colour#get_alpha # @return [Integer] def alpha; end # Returns the blue intensity. # # @see Wx::Colour#get_blue # @return [Integer] def blue; end # Returns the alpha value, on platforms where alpha is not yet supported, this always returns {Wx::ALPHA_OPAQUE}. # @return [Integer] def get_alpha; end # Returns the blue intensity as unsigned int. # @return [Integer] def get_blue; end # Returns the green intensity as unsigned int. # @return [Integer] def get_green; end # Returns the red intensity as unsigned int. # @return [Integer] def get_red; end # Converts this colour to a {Wx::String} using the given flags. # The supported flags are {Wx::C2S_NAME}, to obtain the colour name (e.g. {colour(255,0,0)} == "red"), {Wx::C2S_CSS_SYNTAX}, to obtain the colour in the "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (e.g. {colour(255,0,0,85)} == "rgba(255,0,0,0.333)"), and {Wx::C2S_HTML_SYNTAX}, to obtain the colour as "#" followed by 6 hexadecimal digits (e.g. {colour(255,0,0)} == "#FF0000"). # This function returns empty string if the colour is not initialized (see {Wx::Colour#is_ok}). Otherwise, the returned string is always non-empty, but the function asserts if the colour has alpha channel (i.e. is non opaque) but {Wx::C2S_CSS_SYNTAX} (which is the only one supporting alpha) is not specified in flags. # For non-solid (i.e. non-RGB) colour this function returns "rgb(??, ?? ??)" or "#??????". # @param flags [Integer] # @return [String] def get_as_string(flags=(wxC2S_NAME|wxC2S_CSS_SYNTAX)) end alias_method :as_string, :get_as_string # Return the perceived brightness of the colour. # This value is computed using the simple # # 0.299*R + 0.587*G + 0.114*B # formula with the coefficients taken from the RGB to YIQ conversion formula and R, G and B being the values of the corresponding colour channels normalized to 0..1 range, so that the return value is 0 for black and 1 for white. # @return [Float] def get_luminance; end alias_method :luminance, :get_luminance # Returns the green intensity. # # @see Wx::Colour#get_green # @return [Integer] def green; end # Returns true if the colour object is valid (the colour has been initialised with RGB values). # @return [true,false] def is_ok; end alias_method :ok?, :is_ok # Returns the red intensity. # # @see Wx::Colour#get_red # @return [Integer] def red; end # Returns true if the color can be described using RGB values, i.e. # is solid, false if it is a pattern (currently only possible on macOS) # @return [true,false] def is_solid; end alias_method :solid?, :is_solid # Tests the equality of two colours by comparing individual red, green, blue intensities and alpha values. # @param colour [Wx::Colour,String,Symbol] # @return [true,false] def ==(colour) end # Make a disabled version of this colour. # This method modifies the object in place and returns the object itself. # @param brightness [Integer] # @return [Wx::Colour] def make_disabled(brightness=255) end # Create a disabled (dimmed) colour from (in/out) rgb parameters. # @param r [unsigned char] # @param g [unsigned char] # @param b [unsigned char] # @param brightness [Integer] # @return [void] def self.make_disabled(r, g, b, brightness=255) end # {Wx::Colour} wrapper for ChangeLightness(r,g,b,ialpha). # @param ialpha [Integer] # @return [Wx::Colour] def change_lightness(ialpha) end # Utility function that simply darkens or lightens a color, based on the specified percentage ialpha. # ialpha of 0 would be make the color completely black, 200 completely white and 100 would not change the color. # @param r [unsigned char] # @param g [unsigned char] # @param b [unsigned char] # @param ialpha [Integer] # @return [void] def self.change_lightness(r, g, b, ialpha) end # Assigns the same value to r, g, b: 0 if on is false, 255 otherwise. # @param r [unsigned char] # @param g [unsigned char] # @param b [unsigned char] # @param on [true,false] # @return [void] def self.create_mono(r, g, b, on) end # @overload self.create_grey(r, g, b) # Create a grey colour from (in/out) rgb parameters using integer arithmetic. # @param r [unsigned char] # @param g [unsigned char] # @param b [unsigned char] # @return [void] # @overload self.create_grey(r, g, b, weight_r, weight_g, weight_b) # Create a grey colour from (in/out) rgb parameters using floating point arithmetic. # Defaults to using the standard ITU-T BT.601 when converting to YUV, where every pixel equals (R * weight_r) + (G * weight_g) + (B * weight_b). # @param r [unsigned char] # @param g [unsigned char] # @param b [unsigned char] # @param weight_r [Float] # @param weight_g [Float] # @param weight_b [Float] # @return [void] def self.create_grey(*args) end # Blend colour, taking alpha into account. # @param fg [Integer] # @param bg [Integer] # @param alpha [Float] # @return [Integer] def self.alpha_blend(fg, bg, alpha) end end # Colour end