Module CubeColourDialog
[hide private]
[frames] | no frames]

Module CubeColourDialog

source code

The CubeColourDialog is an alternative implementation of wx.ColourDialog, and it offers different functionalities with respect to the default wxPython one. It can be used as a replacement of wx.ColourDialog with exactly the same syntax and methods.

Some features:

And much more.

License And Version:

CubeColourDialog is freeware and distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 16 Aug 2007, 20.00 GMT

Version 0.1.

Classes [hide private]
  Colour
This is a subclass of wx.Colour, which adds Hue, Saturation and Brightness capability to the base class.
  LineDescription
Simple class to store description and constants for a line in 2D space.
  BasePyControl
Base class used to hold common code for the HSB colour wheel and the RGB colour cube.
  RGBCube
Implements the drawing, mouse handling and sizing routines for the RGB cube colour.
  HSVWheel
Implements the drawing, mouse handling and sizing routines for the HSV colour wheel.
  BaseLineCtrl
Base class used to hold common code for the Alpha channel control and the brightness palette control.
  BrightCtrl
Implements the drawing, mouse handling and sizing routines for the brightness palette control.
  AlphaCtrl
Implements the drawing, mouse handling and sizing routines for the alpha channel control.
  ColourPanel
Simple custom class used to display "old" and "new" colour panels, with alpha blending capabilities.
  CubeColourDialog
This is the CubeColourDialog main class implementation.

Functions [hide private]
  rad2deg(x)
Transforms radians into degrees.
  deg2rad(x)
Transforms degrees into radians.
  toscale(x)
Normalize a value as a function of the radius.
  scaletomax(x)
Normalize a value as a function of the radius.
  rgb2html(colour)
Transforms a RGB triplet into an html hex string.
  Slope(pt1, pt2)
Calculates the slope of the line connecting 2 points.
  Intersection(line1, line2)
Calculates the intersection point between 2 lines.
  FindC(line)
Internal function.
  PointOnLine(pt1, pt2, length, maxLen)
Internal function.
  Distance(pt1, pt2)
Returns the distance between 2 points.
  AngleFromPoint(pt, center)
Returns the angle between the x-axis and the line connecting the center and the point pt.
  PtFromAngle(angle, sat, center)
Given the angle with respect to the x-axis, returns the point based on the saturation value.
  RestoreOldDC(dc, oldPen, oldBrush, oldMode)
Restores the old settings for a wx.DC.
  DrawCheckerBoard(dc, rect, checkColour, box=5)
Draws a checkerboard on a wx.DC.

Variables [hide private]
  CCD_SHOW_ALPHA = 1
Show the alpha control in the dialog.
  RADIUS = 100
Radius of the HSB colour wheel.
  RECT_WIDTH = 5
Width of the mouse-controlled colour pointer.
  BLUE = 2
  GREEN = 1
  RED = 0

Function Details [hide private]

rad2deg(x)

source code 
Transforms radians into degrees.

deg2rad(x)

source code 
Transforms degrees into radians.

toscale(x)

source code 
Normalize a value as a function of the radius.

scaletomax(x)

source code 
Normalize a value as a function of the radius.

rgb2html(colour)

source code 
Transforms a RGB triplet into an html hex string.

Slope(pt1, pt2)

source code 
Calculates the slope of the line connecting 2 points.

Intersection(line1, line2)

source code 
Calculates the intersection point between 2 lines.

FindC(line)

source code 
Internal function.

PointOnLine(pt1, pt2, length, maxLen)

source code 
Internal function.

Distance(pt1, pt2)

source code 
Returns the distance between 2 points.

AngleFromPoint(pt, center)

source code 
Returns the angle between the x-axis and the line connecting the center and the point pt.

PtFromAngle(angle, sat, center)

source code 
Given the angle with respect to the x-axis, returns the point based on the saturation value.

RestoreOldDC(dc, oldPen, oldBrush, oldMode)

source code 
Restores the old settings for a wx.DC.

DrawCheckerBoard(dc, rect, checkColour, box=5)

source code 
Draws a checkerboard on a wx.DC. Used for the Alpha channel control and the colour panels.

Variables Details [hide private]

CCD_SHOW_ALPHA

Show the alpha control in the dialog.
Value:
1                                                                     
      

RADIUS

Radius of the HSB colour wheel.
Value:
100                                                                   
      

RECT_WIDTH

Width of the mouse-controlled colour pointer.
Value:
5                                                                     
      

BLUE

None
Value:
2                                                                     
      

GREEN

None
Value:
1                                                                     
      

RED

None
Value:
0