⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image.tex

📁 Wxpython Implemented on Windows CE, Source code
💻 TEX
📖 第 1 页 / 共 4 页
字号:

\wxheading{See also}

\helpref{Resize}{wximageresize}


\membersection{wxImage::SetAlpha}\label{wximagesetalpha}

\func{void}{SetAlpha}{\param{unsigned char *}{alpha = {\tt NULL}},\param{bool}{ static\_data = \false}}

This function is similar to \helpref{SetData}{wximagesetdata} and has similar
restrictions. The pointer passed to it may however be {\tt NULL} in which case
the function will allocate the alpha array internally -- this is useful to add
alpha channel data to an image which doesn't have any. If the pointer is not
{\tt NULL}, it must have one byte for each image pixel and be allocated with
{\tt malloc()}. wxImage takes ownership of the pointer and will free it unless
\arg{static\_data} parameter is set to \true -- in this case the caller should
do it.

\func{void}{SetAlpha}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{alpha}}

Sets the alpha value for the given pixel. This function should only be called
if the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} to
check for this.


\membersection{wxImage::SetData}\label{wximagesetdata}

\func{void}{SetData}{\param{unsigned char*}{data}}

Sets the image data without performing checks. The data given must have
the size (width*height*3) or results will be unexpected. Don't use this
method if you aren't sure you know what you are doing.

The data must have been allocated with {\tt malloc()}, {\large {\bf NOT}} with
{\tt operator new}.

After this call the pointer to the data is owned by the wxImage object,
that will be responsible for deleting it.
Do not pass to this function a pointer obtained through
\helpref{wxImage::GetData}{wximagegetdata}.


\membersection{wxImage::SetMask}\label{wximagesetmask}

\func{void}{SetMask}{\param{bool}{ hasMask = true}}

Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.


\membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}

\func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}

Sets the mask colour for this image (and tells the image to use the mask).


\membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage}

\func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}}

\wxheading{Parameters}

\docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.}

\docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.}

Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
in {\it mask} will be masked in the image. This is done by first finding an
unused colour in the image, setting this colour as the mask colour and then
using this colour to draw all pixels in the image who corresponding pixel
in {\it mask} has given RGB value.

\wxheading{Return value}

Returns false if {\it mask} does not have same dimensions as the image or if
there is no unused colour left. Returns true if the mask was successfully
applied.

\wxheading{Notes}

Note that this method involves computing the histogram, which is
computationally intensive operation.


\membersection{wxImage::SetOption}\label{wximagesetoption}

\func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}}

\func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}}

Sets 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::GetOption}{wximagegetoption},\rtfsp
\helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
\helpref{wxImage::HasOption}{wximagehasoption}


\membersection{wxImage::SetPalette}\label{wximagesetpalette}

\func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}

Associates a palette with the image. The palette may be used when converting
wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).


\membersection{wxImage::SetRGB}\label{wximagesetrgb}

\func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}

Sets the pixel at the given coordinate. This routine performs bounds-checks
for the coordinate so it can be considered a safe way to manipulate the
data, but in some cases this might be too slow so that the data will have to
be set directly. In that case you will have to get access to the image data
using the \helpref{GetData}{wximagegetdata} method.


\membersection{wxImage::SetRGB}\label{wximagesetrgbrect}

\func{void}{SetRGB}{\param{wxRect \& }{rect}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}

Sets the colour of the pixels within the given rectangle. This routine performs
bounds-checks for the coordinate so it can be considered a safe way to manipulate the
data.


\membersection{wxImage::operator $=$}\label{wximageassign}

\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}

Assignment operator. This operator does not copy any data, but instead
passes a pointer to the data in {\it image} and increments a reference
counter. It is a fast operation.

\wxheading{Parameters}

\docparam{image}{Image to assign.}

\wxheading{Return value}

Returns 'this' object.


\membersection{wxImage::operator $==$}\label{wximageequal}

\constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}

Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).

\wxheading{Parameters}

\docparam{image}{Image to compare with 'this'}

\wxheading{Return value}

Returns true if the images were effectively equal, false otherwise.


\membersection{wxImage::operator $!=$}\label{wximagenotequal}

\constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}

Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).

\wxheading{Parameters}

\docparam{image}{Image to compare with 'this'}

\wxheading{Return value}

Returns true if the images were unequal, false otherwise.

\section{\class{wxImageHandler}}\label{wximagehandler}

This is the base class for implementing image file loading/saving, and image creation from data.
It is used within wxImage and is not normally seen by the application.

If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
application initialisation.

\wxheading{Note (Legal Issue)}

This software is based in part on the work of the Independent JPEG Group.

(Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg
created by IJG.)

\wxheading{Derived from}

\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/image.h>

\wxheading{See also}

\helpref{wxImage}{wximage},
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}

\latexignore{\rtfignore{\wxheading{Members}}}


\membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerctor}

\func{}{wxImageHandler}{\void}

Default constructor. In your own default constructor, initialise the members
m\_name, m\_extension and m\_type.


\membersection{wxImageHandler::\destruct{wxImageHandler}}\label{wximagehandlerdtor}

\func{}{\destruct{wxImageHandler}}{\void}

Destroys the wxImageHandler object.


\membersection{wxImageHandler::GetName}\label{wximagehandlergetname}

\constfunc{wxString}{GetName}{\void}

Gets the name of this handler.


\membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}

\constfunc{wxString}{GetExtension}{\void}

Gets the file extension associated with this handler.


\membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}

\func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}

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{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.}

\wxheading{Return value}

Number of available images. For most image handlers, this is 1 (exceptions
are TIFF and ICO formats).


\membersection{wxImageHandler::GetType}\label{wximagehandlergettype}

\constfunc{long}{GetType}{\void}

Gets the image type associated with this handler.


\membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}

\constfunc{wxString}{GetMimeType}{\void}

Gets the MIME type associated with this handler.


\membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}

\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=true}, \param{int}{ index=0}}

Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
more than one image and the image handler is capable of retrieving these individually, {\it index}
indicates which image to read from the stream.

\wxheading{Parameters}

\docparam{image}{The image object which is to be affected by this operation.}

\docparam{stream}{Opened input stream for reading image data.}

\docparam{verbose}{If set to true, errors reported by the image handler will produce wxLogMessages.}

\docparam{index}{The index of the image in the file (starting from zero).}

\wxheading{Return value}

true if the operation succeeded, false otherwise.

\wxheading{See also}

\helpref{wxImage::LoadFile}{wximageloadfile},
\helpref{wxImage::SaveFile}{wximagesavefile},
\helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}


\membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}

\func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}

Saves a image in the output stream.

\wxheading{Parameters}

\docparam{image}{The image object which is to be affected by this operation.}

\docparam{stream}{Opened output stream for writing the data.}

\wxheading{Return value}

true if the operation succeeded, false otherwise.

\wxheading{See also}

\helpref{wxImage::LoadFile}{wximageloadfile},
\helpref{wxImage::SaveFile}{wximagesavefile},
\helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}


\membersection{wxImageHandler::SetName}\label{wximagehandlersetname}

\func{void}{SetName}{\param{const wxString\& }{name}}

Sets the handler name.

\wxheading{Parameters}

\docparam{name}{Handler name.}


\membersection{wxImageHandler::SetExtension}\label{wximagehandlersetextension}

\func{void}{SetExtension}{\param{const wxString\& }{extension}}

Sets the handler extension.

\wxheading{Parameters}

\docparam{extension}{Handler extension.}


\membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype}

\func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}

Sets the handler MIME type.

\wxheading{Parameters}

\docparam{mimename}{Handler MIME type.}


\membersection{wxImageHandler::SetType}\label{wximagehandlersettype}

\func{void}{SetType}{\param{long }{type}}

Sets the handler type.

\wxheading{Parameters}

\docparam{name}{Handler type.}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -