.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.colourchooser.pypalette
.. highlight:: python
.. _wx.lib.colourchooser.pypalette.PyPalette:
==========================================================================================================================================
|phoenix_title| **wx.lib.colourchooser.pypalette.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| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
PyPalette:
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.colourchooser.canvas.Canvas`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.__init__` Creates a palette object.
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.ClearPoint`
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.DoGetBestClientSize` Overridden to create a client window that exactly fits our bitmap
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.DrawBuffer` Draws the palette XPM into the memory buffer.
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.GeneratePaletteBMP` The actual palette drawing algorithm.
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.GetValue` Returns a colour value at a specific x, y coordinate pair. This
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.HighlightPoint` Highlights an area of the palette with a little circle around
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.xInBounds` Limit x to [0,width)
:meth:`~wx.lib.colourchooser.pypalette.PyPalette.yInBounds` Limit y to [0,height)
================================================================================ ================================================================================
|
|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:: ClearPoint(self)
.. method:: DoGetBestClientSize(self)
Overridden to create a client window that exactly fits our bitmap
.. 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 .
Speed is tweakable by changing the granularity factor, but
that affects how nice the output looks (makes the vertical
blocks bigger. This method was used to generate the embedded
XPM data.
.. method:: GetValue(self, x, y)
Returns a colour value at a specific x, y coordinate pair. This
is useful for determining the colour found a specific mouse click
in an external event handler.
.. method:: HighlightPoint(self, x, y)
Highlights an area of the palette with a little circle around
the coordinate point
.. method:: xInBounds(self, x)
Limit x to [0,width)
.. method:: yInBounds(self, y)
Limit y to [0,height)