 # cubecolourdialog functions¶

This is the description of standalone Python functions in the cubecolourdialog module.

## Functions Summary¶

 AngleFromPoint Returns the angle between the x-axis and the line connecting the center and the point pt. Distance Returns the distance between 2 points. DrawCheckerBoard Draws a checkerboard on a wx.DC. FindC Internal function. Intersection Calculates the intersection point between 2 lines. PointOnLine Internal function. PtFromAngle Given the angle with respect to the x-axis, returns the point based on the saturation value. RestoreOldDC Restores the old settings for a wx.DC. Slope Calculates the slope of the line connecting 2 points. deg2rad Transforms degrees into radians. rad2deg Transforms radians into degrees. rgb2html Transforms a RGB triplet into an html hex string. scaletomax Normalize a value as a function of the radius. toscale Normalize a value as a function of the radius.

## Functions API¶

AngleFromPoint(pt, center)[source]

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

Parameters: pt – an instance of wx.Point; center – a float value representing the center.

Distance(pt1, pt2)[source]

Returns the distance between 2 points.

Parameters: pt1 – an instance of wx.Point; pt2 – another instance of wx.Point.

DrawCheckerBoard(dc, rect, checkColour, box=5)[source]

Draws a checkerboard on a wx.DC.

Parameters: dc – an instance of wx.DC; rect – the client rectangle on which to draw the checkerboard; checkColour – the colour used for the dark checkerboards; box – the checkerboards box sizes.

Note

Used for the Alpha channel control and the colour panels.

FindC(line)[source]

Internal function.

Intersection(line1, line2)[source]

Calculates the intersection point between 2 lines.

Parameters: line1 – an instance of LineDescription; line2 – another instance of LineDescription.

PointOnLine(pt1, pt2, length, maxLen)[source]

Internal function.

PtFromAngle(angle, sat, center)[source]

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

Parameters: angle – a float representing an angle; sat – a float representing the colour saturation value; center – a float value representing the center.

RestoreOldDC(dc, oldPen, oldBrush, oldMode)[source]

Restores the old settings for a wx.DC.

Parameters: dc – an instance of wx.DC; oldPen – an instance of wx.Pen; oldBrush – an instance of wx.Brush; oldMode – the wx.DC drawing mode bit.

Slope(pt1, pt2)[source]

Calculates the slope of the line connecting 2 points.

Parameters: pt1 – an instance of wx.Point; pt2 – another instance of wx.Point.

Parameters: x – a float representing an angle in degrees.

Parameters: x – a float representing an angle in radians.

rgb2html(colour)[source]

Transforms a RGB triplet into an html hex string.

Parameters: colour – a tuple of red, green, blue integers.

scaletomax(x)[source]

Normalize a value as a function of the radius.

Parameters: x – a float value to normalize

toscale(x)[source]

Normalize a value as a function of the radius.

Parameters: x – a float value to normalize AGW

Tree