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
|
.. 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
.. module:: wx.lib.imageutils
.. currentmodule:: wx.lib.imageutils
.. highlight:: python
.. _wx.lib.imageutils:
==========================================================================================================================================
|phoenix_title| **wx.lib.imageutils**
==========================================================================================================================================
This module contains a collection of functions for simple image manipulations.
Description
===========
This module contains a collection of functions for simple image manipulations.
The 2 functions defined here (:func:`grayOut`, :func:`makeGray` and :func:`stepColour`)
can be used to convert a given image into a grey-scale representation and to
darken/lighten a specific wxPython :class:`wx.Colour`.
Usage
=====
Sample usage::
import wx
from wx.lib.imageutils import grayOut, stepColour
app = wx.App(0)
bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (32, 32))
disabled_bmp = wx.Bitmap(grayOut(bmp.ConvertToImage()))
colour = wx.Colour(100, 120, 130)
# Darker
dark_colour = stepColour(colour, 50)
# Lighter
light_colour = stepColour(colour, 120)
app.MainLoop()
|function_summary| Functions Summary
====================================
================================================================================ ================================================================================
:func:`~wx.lib.imageutils.grayOut` Convert the given image (in place) to a grayed-out
:func:`~wx.lib.imageutils.makeGray` Make a pixel grayed-out. If the pixel matches the maskColor, it won't be
:func:`~wx.lib.imageutils.stepColour` An utility function that simply darkens or lightens a
================================================================================ ================================================================================
|
Functions
------------
.. function:: grayOut(anImage)
Convert the given image (in place) to a grayed-out
version, appropriate for a 'disabled' appearance.
:param wx.Image `anImage`: the image we want to convert to gray-scale.
:rtype: :class:`wx.Image`
:returns: The modified (greyed out) image.
.. note:: the image is converted in place, i.e. the input image will
be modified to a greyed out version.
.. function:: makeGray(rgb, factor, maskColor)
Make a pixel grayed-out. If the pixel matches the maskColor, it won't be
changed.
:param tuple `rgb`: a tuple of red, green, blue integers, defining the pixel :class:`wx.Colour`;
:param float `factor`: the amount for which we want to grey out a pixel colour;
:param `maskColor`: the mask colour.
:type `maskColor`: tuple or :class:`wx.Colour`.
:rtype: tuple
:returns: An RGB tuple with the greyed out pixel colour.
.. function:: stepColour(c, step)
An utility function that simply darkens or lightens a
color, based on the specified step value. A step of 0 is
completely black and a step of 200 is totally white, and 100
results in the same color as was passed in.
:param wx.Colour `c`: the input colour to be modified (darkened or lightened);
:param integer `step`: the step value.
:rtype: :class:`wx.Colour`
:returns: A new colour, darkened or lightened depending on the input `step` value.
|