PyANGKernel.GKColorRamp¶
- class GKColorRamp¶
Creates a N colors in a range of colors defined two or more colors.
Details
Color 0 will be the from color, color N-1 will be the to color, the other (intermediate) colors will be interpolate among all the available colors.
A ramp of 1 color is possible: only this color will be returned.
Three ramps are created automatically: - HSV_RED_YELLOW_GREEN: a HSV ramp from red to yellow to green - HSV_GREEN_YELLOW_RED: a HSV ramp from green to yellow to red - HSV_RED_GREEN_RED: a HSV ramp from red to green to red
Other ramps will be read from XML files in $RESOURCES_HOME/shared/color_ramps. The format of the XML file is:
<color_ramp name="RAMP_NAME" type="RAMP_TYPE" coded="RAMP_CODED"> <color>COLOR_DATA</color> <color>COLOR_DATA</color> ... </color_ramp>
Where: - RAMP_NAME: is the name of the ramp. - RAMP_TYPE: is the color space to be use when interpolating, either RGB or HSV - RAMP_CODED: how colors are specified, either HEX or DECIMAL - COLOR_DATA: the color. The format varies according to RAMP_CODED: - HEX: #RRGGBB, where: - RR is the hexadecimal red component from 00 to ff - GG is the hexadecimal green component from 00 to ff - BB is the hexadecimal blue component from 00 to ff - DECIMAL: RRR GGG BBB (space separated), where: - RRR is the decimal red component from 0 to 255 - GGG is the decimal green component from 0 to 255 - BBB is the decimal blue component from 0 to 255
Note that colors are specified in RGB. The RAMP_TYPE is used only in the interpolation.
Example 1: a gray ramp using HEX
<color_ramp name="GRAY" type="RBG" coded="HEX"> <color>#000000</color> <color>#ffffff</color> </color_ramp>
Example 2: a gray ramp using DECIMAL
<color_ramp name="GRAY" type="RBG" coded="DECIMAL"> <color>0 0 0</color> <color>255 255 255</color> </color_ramp>
Synopsis¶
Methods¶
def
__init__()def
addColor()def
getColor()def
getName()def
getPixmap()def
jet()def
lines()def
setColors()def
setName()def
setType()def
size()
Static functions¶
def
getRamp()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class ColorType¶
color representation type: eRGB: color defined in red, green and blue components eHSV: color defined in Hue, Saturation, Value components
- __init__()¶
Adds a color (at the end) to this ramp
The “nbColors” holds how many colors we will use (to know if a interpolation will be needed). If nbColors is 0 then all the possible colors will be used (equivalent to ramp->getColor( pos, ramp->
size()) )returns the color ramp name, it should be unique in order to make
getRampmethod work correctly.- getPixmap(width, height, nbColors[, orientation=Qt.Horizontal])¶
- Parameters:
width – int
height – int
nbColors – int
orientation –
Orientation
- Return type:
returns a pixmap of the specified size (width and height) and having the specified number of colors and orientation
- static getRamp(byName)¶
- Parameters:
byName – str
- Return type:
returns the ramp byName
- jet(nbColors)¶
- Parameters:
nbColors – int
Configure the color ramp with nbColors following the jet colormap of Matlab.
- lines(nbColors)¶
- Parameters:
nbColors – int
Configure the color ramp with nbColors following the lines colormap of Matlab.
Set the two colors to be use to calculate colors in this ramp
Set the three colors to be use to calculate colors in this ramp
- setName(aname)¶
- Parameters:
aname – str
sets the color ramp name
sets the color representation type
Returns the number of colors (its size) in this color ramp