📄 image.tex
字号:
\docparam{startR,startG,startB}{Initial values of the colour. Returned colour
will have RGB values equal to or greater than these.}
Finds the first colour that is never used in the image. The search begins at
given initial colour and continues by increasing R, G and B components (in this
order) by 1 until an unused colour is found or the colour space exhausted.
\wxheading{Return value}
Returns false if there is no unused colour left, true on success.
\wxheading{Notes}
Note that this method involves computing the histogram, which is
computationally intensive operation.
\membersection{wxImage::FindHandler}\label{wximagefindhandler}
\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}}
Finds the handler with the given name.
\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}}
Finds the handler associated with the given extension and type.
\func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}}
Finds the handler associated with the given image type.
\func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}}
Finds the handler associated with the given MIME type.
\docparam{name}{The handler name.}
\docparam{extension}{The file extension, such as ``bmp".}
\docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.}
\docparam{mimetype}{MIME type.}
\wxheading{Return value}
A pointer to the handler if found, NULL otherwise.
\wxheading{See also}
\helpref{wxImageHandler}{wximagehandler}
\membersection{wxImage::GetImageExtWildcard}\label{wximagegetimageextwildcard}
\func{static wxString}{GetImageExtWildcard}{\void}
Iterates all registered wxImageHandler objects, and returns a string containing file extension masks
suitable for passing to file open/save dialog boxes.
\wxheading{Return value}
The format of the returned string is "(*.ext1;*.ext2)|*.ext1;*.ext2".
It is usually a good idea to prepend a description before passing the result to the dialog.
Example:
\begin{verbatim}
wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
\end{verbatim}
\wxheading{See also}
\helpref{wxImageHandler}{wximagehandler}
\membersection{wxImage::GetAlpha}\label{wximagegetalpha}
\constfunc{unsigned char}{GetAlpha}{\param{int}{ x}, \param{int}{ y}}
Returns the alpha value for the given pixel. This function may only be called
for the images with alpha channel, use \helpref{HasAlpha}{wximagehasalpha} to
check for this.
The returned value is the {\it opacity} of the image, i.e. the value of $0$
corresponds to the transparent pixels while the value of $255$ -- to the opaque
ones.
\constfunc{unsigned char *}{GetAlpha}{\void}
Returns pointer to the array storing the alpha values for this image. This
pointer is {\tt NULL} for the images without the alpha channel. If the image
does have it, this pointer may be used to directly manipulate the alpha values
which are stored as the \helpref{RGB}{wximagegetdata} ones.
\membersection{wxImage::GetBlue}\label{wximagegetblue}
\constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
Returns the blue intensity at the given coordinate.
\membersection{wxImage::GetData}\label{wximagegetdata}
\constfunc{unsigned char*}{GetData}{\void}
Returns the image data as an array. This is most often used when doing
direct image manipulation. The return value points to an array of
characters in RGBRGBRGB$\ldots$ format in the top-to-bottom, left-to-right
order, that is the first RGB triplet corresponds to the pixel first pixel of
the first row, the second one --- to the second pixel of the first row and so
on until the end of the first row, with second row following after it and so
on.
You should not delete the returned pointer nor pass it to
\helpref{wxImage::SetData}{wximagesetdata}.
\membersection{wxImage::GetGreen}\label{wximagegetgreen}
\constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
Returns the green intensity at the given coordinate.
\membersection{wxImage::GetImageCount}\label{wximagegetimagecount}
\func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
\func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
If the image file contains more than one image and the image handler is capable
of retrieving these individually, this function will return the number of
available images.
\docparam{name}{Name of the file to query.}
\docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.}
\docparam{type}{May be one of the following:
\twocolwidtha{5cm}%
\begin{twocollist}
\twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}}
\wxheading{Return value}
Number of available images. For most image handlers, this is 1 (exceptions
are TIFF and ICO formats).
\membersection{wxImage::GetHandlers}\label{wximagegethandlers}
\func{static wxList\&}{GetHandlers}{\void}
Returns the static list of image format handlers.
\wxheading{See also}
\helpref{wxImageHandler}{wximagehandler}
\membersection{wxImage::GetHeight}\label{wximagegetheight}
\constfunc{int}{GetHeight}{\void}
Gets the height of the image in pixels.
\membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
\constfunc{unsigned char}{GetMaskBlue}{\void}
Gets the blue value of the mask colour.
\membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
\constfunc{unsigned char}{GetMaskGreen}{\void}
Gets the green value of the mask colour.
\membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
\constfunc{unsigned char}{GetMaskRed}{\void}
Gets the red value of the mask colour.
\membersection{wxImage::GetOrFindMaskColour}\label{wximagegetgetorsetmaskcolour}
\constfunc{bool}{GetOrFindMaskColour}{\param{unsigned char}{ *r}, \param{unsigned char}{ *g}, \param{unsigned char}{ *b}}
Get the current mask colour or find a suitable unused colour that could be
used as a mask colour. Returns {\tt true} if the image currently has a mask.
\membersection{wxImage::GetPalette}\label{wximagegetpalette}
\constfunc{const wxPalette\&}{GetPalette}{\void}
Returns the palette associated with the image. Currently the palette is only
used when converting to wxBitmap under Windows.
Eventually wxImage handlers will set the palette if one exists in the image file.
\membersection{wxImage::GetRed}\label{wximagegetred}
\constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
Returns the red intensity at the given coordinate.
\membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
\constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
Returns a sub image of the current one as long as the rect belongs entirely to
the image.
\membersection{wxImage::GetWidth}\label{wximagegetwidth}
\constfunc{int}{GetWidth}{\void}
Gets the width of the image in pixels.
\wxheading{See also}
\helpref{wxImage::GetHeight}{wximagegetheight}
\membersection{HSVValue::HSVValue}\label{hsvvaluehsvvalue}
\func{}{HSVValue}{\param{double }{h = 0.0}, \param{double }{s = 0.0}, \param{double }{v = 0.0}}
Constructor for HSVValue, an object that contains values for hue, saturation and value which
represent the value of a color. It is used by \helpref{wxImage::HSVtoRGB}{wximagehsvtorgb}
and \helpref{wxImage::RGBtoHSV}{wximagergbtohsv}, which
converts between HSV color space and RGB color space.
\pythonnote{use wxImage\_HSVValue in wxPython}
\membersection{wxImage::HSVtoRGB}\label{wximagehsvtorgb}
\func{wxImage::RGBValue}{HSVtoRGB}{\param{const HSVValue \& }{hsv}}
Converts a color in HSV color space to RGB color space.
\membersection{wxImage::HasAlpha}\label{wximagehasalpha}
\constfunc{bool}{HasAlpha}{\void}
Returns true if this image has alpha channel, false otherwise.
\wxheading{See also}
\helpref{GetAlpha}{wximagegetalpha}, \helpref{SetAlpha}{wximagesetalpha}
\membersection{wxImage::HasMask}\label{wximagehasmask}
\constfunc{bool}{HasMask}{\void}
Returns true if there is a mask active, false otherwise.
\membersection{wxImage::GetOption}\label{wximagegetoption}
\constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}}
Gets a user-defined option. The function is case-insensitive to {\it name}.
For example, when saving as a JPEG file, the option {\bf quality} is
used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
\wxheading{See also}
\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
\helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
\helpref{wxImage::HasOption}{wximagehasoption}
\membersection{wxImage::GetOptionInt}\label{wximagegetoptionint}
\constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}}
Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
If the given option is not present, the function returns $0$. Use
\helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
for the option.
Options for wxPNGHandler
\twocolwidtha{5cm}%
\begin{twocollist}
\twocolitem{wxIMAGE\_OPTION\_PNG\_FORMAT}{Format for saving a PNG file.}
\twocolitem{wxIMAGE\_OPTION\_PNG\_BITDEPTH}{Bit depth for every channel (R/G/B/A).}
\end{twocollist}
Supported values for wxIMAGE\_OPTION\_PNG\_FORMAT:
\twocolwidtha{5cm}%
\begin{twocollist}
\twocolitem{wxPNG\_TYPE\_COLOUR}{Stores RGB image.}
\twocolitem{wxPNG\_TYPE\_GREY}{Stores grey image, converts from RGB.}
\twocolitem{wxPNG\_TYPE\_GREY\_RED}{Stores grey image, uses red value as grey.}
\end{twocollist}
\wxheading{See also}
\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
\helpref{wxImage::GetOption}{wximagegetoption}
\membersection{wxImage::HasOption}\label{wximagehasoption}
\constfunc{bool}{HasOption}{\param{const wxString\&}{ name}}
Returns true if the given option is present. The function is case-insensitive to {\it name}.
\wxheading{See also}
\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
\helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
\helpref{wxImage::GetOptionInt}{wximagegetoptionint}
\membersection{wxImage::InitAlpha}\label{wximageinitalpha}
\func{void}{InitAlpha}{\void}
Initializes the image alpha channel data. It is an error to call it
if the image already has alpha data. If it doesn't, alpha data will be
by default initialized to all pixels being fully opaque. But if the image has a
a mask colour, all mask pixels will be completely transparent.
\membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
\func{static void}{InitStandardHandlers}{\void}
Internal use only. Adds standard image format handlers. It only install BMP
for the time being, which is used by wxBitmap.
This function is called by wxWidgets on startup, and shouldn't be called by
the user.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -