1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 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
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>PyPalette</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.colourchooser.pypalette.PyPalette_inheritance.png" alt="Inheritance diagram of PyPalette" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="35,5,136,35"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="87,83,197,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="82,160,203,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="160,5,241,35"/> <area shape="rect" id="node4" href="wx.lib.colourchooser.pypalette.PyPalette.html" title="wx.lib.colourchooser.pypalette.PyPalette" alt="" coords="5,392,280,421"/> <area shape="rect" id="node5" href="wx.lib.colourchooser.canvas.Canvas.html" title="wx.lib.colourchooser.canvas.Canvas" alt="" coords="18,315,267,344"/> <area shape="rect" id="node7" href="wx.Window.html" title="wx.Window" alt="" coords="98,237,187,267"/> </map>
</p>
|
|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 <http://cpbotha.net/>.
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)
|