.. include:: headings.inc .. currentmodule:: lib.colourchooser.pypalette .. highlight:: python .. _lib.colourchooser.pypalette.PyPalette: ========================================================================================================================================== |phoenix_title| **PyPalette** ========================================================================================================================================== The Pure-Python Palette The PyPalette is a pure python implementation of a colour palette. The palette implementation here imitates the palette layout used by MS Windows and Adobe Photoshop. The actual palette image has been embedded as an XPM for speed. The actual reverse-engineered drawing algorithm is provided in the GeneratePaletteBMP() method. The algorithm is tweakable by supplying the granularity factor to improve speed at the cost of display beauty. Since the generator isn't used in real time, no one will likely care :) But if you need it for some sort of unforeseen realtime application, it's there. | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **PyPalette** .. raw:: html
| |super_classes| Known Superclasses ================================== :class:`lib.colourchooser.canvas.Canvas` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~lib.colourchooser.pypalette.PyPalette.__init__` Creates a palette object. :meth:`~lib.colourchooser.pypalette.PyPalette.DrawBuffer` Draws the palette XPM into the memory buffer. :meth:`~lib.colourchooser.pypalette.PyPalette.GeneratePaletteBMP` The actual palette drawing algorithm. :meth:`~lib.colourchooser.pypalette.PyPalette.GetValue` Returns a colour value at a specific x, y coordinate pair. This :meth:`~lib.colourchooser.pypalette.PyPalette.HighlightPoint` Highlights an area of the palette with a little circle around ================================================================================ ================================================================================ | |api| Class API =============== .. class:: PyPalette(canvas.Canvas) The Pure-Python Palette The PyPalette is a pure python implementation of a colour palette. The palette implementation here imitates the palette layout used by MS Windows and Adobe Photoshop. The actual palette image has been embedded as an XPM for speed. The actual reverse-engineered drawing algorithm is provided in the GeneratePaletteBMP() method. The algorithm is tweakable by supplying the granularity factor to improve speed at the cost of display beauty. Since the generator isn't used in real time, no one will likely care :) But if you need it for some sort of unforeseen realtime application, it's there. .. method:: __init__(self, parent, id) Creates a palette object. .. method:: DrawBuffer(self) Draws the palette XPM into the memory buffer. .. method:: GeneratePaletteBMP(self, file_name, granularity=1) The actual palette drawing algorithm. This used to be 100% reverse engineered by looking at the values on the MS map, but has since been redone Correctly(tm) according to the HSV (hue, saturation, value) colour model by Charl P. Botha