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

📄 image.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 4 页
字号:
when using a single mask colour for transparency, as the scaling will blur theimage and will therefore remove the mask partially. Using the alpha channelwill work.Example:\begin{verbatim}    // get the bitmap from somewhere    wxBitmap bmp = ...;    // rescale it to have size of 32*32    if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )    {        wxImage image = bmp.ConvertToImage();        bmp = wxBitmap(image.Scale(32, 32));        // another possibility:        image.Rescale(32, 32);        bmp = image;    }\end{verbatim}\wxheading{See also}\helpref{Rescale}{wximagerescale}\membersection{wxImage::Size}\label{wximagesize}\constfunc{wxImage}{Size}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}Returns a resized version of this image without scaling it by adding either a borderwith the given colour or cropping as necessary. The image is pasted into a newimage with the given {\it size} and background colour at the position {\it pos}relative to the upper left of the new image. If {\it red = green = blue = -1}then use either the current mask colour if set or find, use, and set asuitable mask colour for any newly exposed areas.\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 similarrestrictions. The pointer passed to it may however be {\tt NULL} in which casethe function will allocate the alpha array internally -- this is useful to addalpha 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 shoulddo 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 calledif the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} tocheck 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 havethe size (width*height*3) or results will be unexpected. Don't use thismethod 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 anunused colour in the image, setting this colour as the mask colour and thenusing this colour to draw all pixels in the image who corresponding pixelin {\it mask} has given RGB value.\wxheading{Return value}Returns false if {\it mask} does not have same dimensions as the image or ifthere is no unused colour left. Returns true if the mask was successfullyapplied.\wxheading{Notes}Note that this method involves computing the histogram, which iscomputationally 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} isused, 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 convertingwxImage 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-checksfor the coordinate so it can be considered a safe way to manipulate thedata, but in some cases this might be too slow so that the data will have tobe set directly. In that case you will have to get access to the image datausing 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 performsbounds-checks for the coordinate so it can be considered a safe way to manipulate thedata.\membersection{wxImage::operator $=$}\label{wximageassign}\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}Assignment operator, using \helpref{reference counting}{trefcount}.\wxheading{Parameters}\docparam{image}{Image to assign.}\wxheading{Return value}Returns 'this' object.\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 wxImageHandlerand add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in yourapplication 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 libjpegcreated 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 membersm\_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{const wxString\&}{GetName}{\void}Gets the name of this handler.\membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}\constfunc{const 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 capableof retrieving these individually, this function will return the number ofavailable 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 (exceptionsare 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{const 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 containsmore 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 + -