1 \section{\class{wxImage
}}\label{wximage
}
3 This class encapsulates a platform-independent image. An image can be created
4 from data, or using the constructor taking a wxBitmap object. An image
5 can be loaded from a file in a variety of formats, and is extensible to new formats
6 via image format handlers. Functions are available to set and get image bits, so
7 it can be used for basic image manipulation.
9 A wxImage cannot (currently) be drawn directly to a
\helpref{wxDC
}{wxdc
}. Instead,
10 a platform-specific
\helpref{wxBitmap
}{wxbitmap
} object must be created from it using
11 the
\helpref{ConvertToBitmap
}{wximageconverttobitmap
} function. This bitmap can then
12 be drawn in a device context, using
\helpref{wxDC::DrawBitmap
}{wxdcdrawbitmap
}.
14 One colour value of the image may be used as a mask colour which will lead to the automatic
15 creation of a
\helpref{wxMask
}{wxmask
} object associated to the bitmap object.
17 \wxheading{Available image handlers
}
19 The following image handlers are available.
{\bf wxBMPHandler
} is always
20 installed by default. To use other image formats, install the appropiate
21 handler with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
22 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
26 \twocolitem{{\bf \indexit{wxBMPHandler
}}}{Only for loading, always installed.
}
27 \twocolitem{{\bf \indexit{wxPNGHandler
}}}{For loading and saving.
}
28 \twocolitem{{\bf \indexit{wxJPEGHandler
}}}{For loading and saving.
}
29 \twocolitem{{\bf \indexit{wxGIFHandler
}}}{Only for loading, due to legal issues.
}
30 \twocolitem{{\bf \indexit{wxPCXHandler
}}}{For loading and saving (see below).
}
31 \twocolitem{{\bf \indexit{wxPNMHandler
}}}{For loading and saving (see below).
}
32 \twocolitem{{\bf \indexit{wxTIFFHandler
}}}{For loading.
}
35 When saving in PCX format,
{\bf wxPCXHandler
} will count the number of
36 different colours in the image; if there are
256 or less colours, it will
37 save as
8 bit, else it will save as
24 bit.
39 Loading PNMs only works for ASCII or raw RGB images. When saving in
40 PNM format,
{\bf wxPNMHandler
} will always save as raw RGB.
42 \wxheading{Derived from
}
44 \helpref{wxObject
}{wxobject
}
46 \wxheading{Include files
}
52 \helpref{wxBitmap
}{wxbitmap
},
53 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}
55 \latexignore{\rtfignore{\wxheading{Members
}}}
57 \membersection{wxImage::wxImage
}\label{wximageconstr
}
59 \func{}{wxImage
}{\void}
63 \func{}{wxImage
}{\param{const wxImage\&
}{image
}}
67 \func{}{wxImage
}{\param{const wxBitmap\&
}{ bitmap
}}
69 Constructs an image from a platform-dependent bitmap. This preserves
70 mask information so that bitmaps and images can be converted back
71 and forth without loss in that respect.
73 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
}}
75 Creates an image with the given width and height.
77 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{unsigned char*
}{ data
},
\param{bool
}{ static_data=FALSE
}}
79 Creates an image from given data with the given width and height. If
80 {\it static_data
} is TRUE, then wxImage will not delete the actual
81 image data in its destructor, otherwise it will free it by calling
84 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY}}
86 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{const wxString\&
}{ mimetype
}}
88 Loads an image from a file.
90 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY}}
92 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{const wxString\&
}{ mimetype
}}
94 Loads an image from an input stream.
96 \wxheading{Parameters
}
98 \docparam{width
}{Specifies the width of the image.
}
100 \docparam{height
}{Specifies the height of the image.
}
102 \docparam{name
}{Name of the file from which to load the image.
}
104 \docparam{stream
}{Opened input stream from which to load the image. Currently, the stream must support seeking.
}
106 \docparam{type
}{May be one of the following:
110 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_BMP}}}{Load a Windows bitmap file.
}
111 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_GIF}}}{Load a GIF bitmap file.
}
112 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_JPEG}}}{Load a JPEG bitmap file.
}
113 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_PNG}}}{Load a PNG bitmap file.
}
114 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_PCX}}}{Load a PCX bitmap file.
}
115 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_PNM}}}{Load a PNM bitmap file.
}
116 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_TIF}}}{Load a TIFF bitmap file.
}
117 \twocolitem{{\bf \indexit{wxBITMAP
\_TYPE\_ANY}}}{Will try to autodetect the format.
}
120 \docparam{mimetype
}{MIME type string (for example 'image/jpeg')
}
124 Depending on how wxWindows has been configured, not all formats may be available.
126 Note: any handler other than BMP must be previously
127 initialized with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
128 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
132 \helpref{wxImage::LoadFile
}{wximageloadfile
}
134 \pythonnote{Constructors supported by wxPython are:
\par
135 \indented{2cm
}{\begin{twocollist
}
136 \twocolitem{{\bf wxImage(name, flag)
}}{Loads an image from a file
}
137 \twocolitem{{\bf wxNullImage()
}}{Create a null image (has no size or
139 \twocolitem{{\bf wxEmptyImage(width, height)
}}{Creates an empty image
141 \twocolitem{{\bf wxImageFromMime(name, mimetype
}}{Creates an image from
142 the given file of the given mimetype
}
143 \twocolitem{{\bf wxImageFromBitmap(bitmap)
}}{Creates an image from a
144 platform-dependent bitmap
}
148 \membersection{wxImage::
\destruct{wxImage
}}
150 \func{}{\destruct{wxImage
}}{\void}
154 \membersection{wxImage::AddHandler
}\label{wximageaddhandler
}
156 \func{static void
}{AddHandler
}{\param{wxImageHandler*
}{ handler
}}
158 Adds a handler to the end of the static list of format handlers.
160 \docparam{handler
}{A new image format handler object. There is usually only one instance
161 of a given handler class in an application session.
}
165 \helpref{wxImageHandler
}{wximagehandler
}
167 \pythonnote{In wxPython this static method is named
{\tt wxImage_AddHandler
}.
}
168 \membersection{wxImage::CleanUpHandlers
}
170 \func{static void
}{CleanUpHandlers
}{\void}
172 Deletes all image handlers.
174 This function is called by wxWindows on exit.
176 \membersection{wxImage::ConvertToBitmap
}\label{wximageconverttobitmap
}
178 \constfunc{wxBitmap
}{ConvertToBitmap
}{\void}
180 Converts the image to a platform-specific bitmap object. This has to be done
181 to actually display an image as you cannot draw an image directly on a window.
182 The resulting bitmap will use the colour depth of the current system which entails
183 that a colour reduction has to take place.
185 When in
8-bit mode (PseudoColour mode), the GTK port will use a
color cube created
186 on program start-up to look up colors. This ensures a very fast conversion, but
187 the image quality won't be perfect (and could be better for photo images using more
188 sophisticated dithering algorithms).
190 \membersection{wxImage::Copy
}\label{wximagecopy
}
192 \constfunc{wxImage
}{Copy
}{\void}
194 Returns an identical copy of the image.
196 \membersection{wxImage::Create
}\label{wximagecreate
}
198 \func{bool
}{Create
}{\param{int
}{ width
},
\param{int
}{ height
}}
200 Creates a fresh image.
202 \wxheading{Parameters
}
204 \docparam{width
}{The width of the image in pixels.
}
206 \docparam{height
}{The height of the image in pixels.
}
208 \wxheading{Return value
}
210 TRUE if the call succeeded, FALSE otherwise.
212 \membersection{wxImage::Destroy
}\label{wximagedestroy
}
214 \func{bool
}{Destroy
}{\void}
216 Destroys the image data.
218 \membersection{wxImage::FindHandler
}
220 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
222 Finds the handler with the given name.
224 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{long
}{ imageType
}}
226 Finds the handler associated with the given extension and type.
228 \func{static wxImageHandler*
}{FindHandler
}{\param{long
}{imageType
}}
230 Finds the handler associated with the given image type.
232 \func{static wxImageHandler*
}{FindHandlerMime
}{\param{const wxString\&
}{mimetype
}}
234 Finds the handler associated with the given MIME type.
236 \docparam{name
}{The handler name.
}
238 \docparam{extension
}{The file extension, such as ``bmp".
}
240 \docparam{imageType
}{The image type, such as wxBITMAP
\_TYPE\_BMP.
}
242 \docparam{mimetype
}{MIME type.
}
244 \wxheading{Return value
}
246 A pointer to the handler if found, NULL otherwise.
250 \helpref{wxImageHandler
}{wximagehandler
}
252 \membersection{wxImage::GetBlue
}\label{wximagegetblue
}
254 \constfunc{unsigned char
}{GetBlue
}{\param{int
}{ x
},
\param{int
}{ y
}}
256 Returns the blue intensity at the given coordinate.
258 \membersection{wxImage::GetData
}\label{wximagegetdata
}
260 \constfunc{unsigned char*
}{GetData
}{\void}
262 Returns the image data as an array. This is most often used when doing
263 direct image manipulation. The return value points to an array of
264 chararcters in RGBGBRGB... format.
266 \membersection{wxImage::GetGreen
}\label{wximagegetgreen
}
268 \constfunc{unsigned char
}{GetGreen
}{\param{int
}{ x
},
\param{int
}{ y
}}
270 Returns the green intensity at the given coordinate.
272 \membersection{wxImage::GetRed
}\label{wximagegetred
}
274 \constfunc{unsigned char
}{GetRed
}{\param{int
}{ x
},
\param{int
}{ y
}}
276 Returns the red intensity at the given coordinate.
278 \membersection{wxImage::GetHandlers
}
280 \func{static wxList\&
}{GetHandlers
}{\void}
282 Returns the static list of image format handlers.
286 \helpref{wxImageHandler
}{wximagehandler
}
288 \membersection{wxImage::GetHeight
}\label{wximagegetheight
}
290 \constfunc{int
}{GetHeight
}{\void}
292 Gets the height of the image in pixels.
294 \membersection{wxImage::GetMaskBlue
}\label{wximagegetmaskblue
}
296 \constfunc{unsigned char
}{GetMaskBlue
}{\void}
298 Gets the blue value of the mask colour.
300 \membersection{wxImage::GetMaskGreen
}\label{wximagegetmaskgreen
}
302 \constfunc{unsigned char
}{GetMaskGreen
}{\void}
304 Gets the green value of the mask colour.
306 \membersection{wxImage::GetMaskRed
}\label{wximagegetmaskred
}
308 \constfunc{unsigned char
}{GetMaskRed
}{\void}
310 Gets the red value of the mask colour.
312 \membersection{wxImage::GetSubImage
}\label{wximagegetsubimage
}
314 \constfunc{wxImage
}{GetSubImage
}{\param{const wxRect\&
}{ rect
}}
316 Returns a sub image of the current one as long as the rect belongs entirely to
319 \membersection{wxImage::GetWidth
}\label{wximagegetwidth
}
321 \constfunc{int
}{GetWidth
}{\void}
323 Gets the width of the image in pixels.
327 \helpref{wxImage::GetHeight
}{wximagegetheight
}
329 \membersection{wxImage::HasMask
}\label{wximagehasmask
}
331 \constfunc{bool
}{HasMask
}{\void}
333 Returns TRUE if there is a mask active, FALSE otherwise.
335 \membersection{wxImage::GetOption
}\label{wximagegetoption
}
337 \constfunc{wxString
}{GetOption
}{\param{const wxString\&
}{ name
}}
339 Gets a user-defined option. The function is case-insensitive to
{\it name
}.
341 For example, when saving as a JPEG file, the option
{\bf quality
} is
342 used, which is a number between
0 and
100 (
0 is terrible,
100 is very good).
346 \helpref{wxImage::SetOption
}{wximagesetoption
},
\rtfsp
347 \helpref{wxImage::GetOptionInt
}{wximagegetoptionint
},
\rtfsp
348 \helpref{wxImage::HasOption
}{wximagehasoption
}
350 \membersection{wxImage::GetOptionInt
}\label{wximagegetoptionint
}
352 \constfunc{int
}{GetOptionInt
}{\param{const wxString\&
}{ name
}}
354 Gets a user-defined option as an integer. The function is case-insensitive to
{\it name
}.
358 \helpref{wxImage::SetOption
}{wximagesetoption
},
\rtfsp
359 \helpref{wxImage::GetOption
}{wximagegetoption
},
\rtfsp
360 \helpref{wxImage::HasOption
}{wximagehasoption
}
362 \membersection{wxImage::HasOption
}\label{wximagehasoption
}
364 \constfunc{bool
}{HasOption
}{\param{const wxString\&
}{ name
}}
366 Returns TRUE if the given option is present. The function is case-insensitive to
{\it name
}.
370 \helpref{wxImage::SetOption
}{wximagesetoption
},
\rtfsp
371 \helpref{wxImage::GetOption
}{wximagegetoption
},
\rtfsp
372 \helpref{wxImage::GetOptionInt
}{wximagegetoptionint
}
374 \membersection{wxImage::InitStandardHandlers
}
376 \func{static void
}{InitStandardHandlers
}{\void}
378 Internal use only. Adds standard image format handlers. It only install BMP
379 for the time being, which is used by wxBitmap.
381 This function is called by wxWindows on startup, and shouldn't be called by
386 \helpref{wxImageHandler
}{wximagehandler
},
387 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}
389 \membersection{wxImage::InsertHandler
}
391 \func{static void
}{InsertHandler
}{\param{wxImageHandler*
}{ handler
}}
393 Adds a handler at the start of the static list of format handlers.
395 \docparam{handler
}{A new image format handler object. There is usually only one instance
396 of a given handler class in an application session.
}
400 \helpref{wxImageHandler
}{wximagehandler
}
402 \membersection{wxImage::LoadFile
}\label{wximageloadfile
}
404 \func{bool
}{LoadFile
}{\param{const wxString\&
}{ name
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY}}
406 \func{bool
}{LoadFile
}{\param{const wxString\&
}{ name
},
\param{const wxString\&
}{ mimetype
}}
408 Loads an image from a file. If no handler type is provided, the library will
409 try to autodetect the format.
411 \func{bool
}{LoadFile
}{\param{wxInputStream\&
}{ stream
},
\param{long
}{ type
}}
413 \func{bool
}{LoadFile
}{\param{wxInputStream\&
}{ stream
},
\param{const wxString\&
}{ mimetype
}}
415 Loads an image from an input stream.
417 \wxheading{Parameters
}
419 \docparam{name
}{Name of the file from which to load the image.
}
421 \docparam{stream
}{Opened input stream from which to load the image. Currently, the stream must support seeking.
}
423 \docparam{type
}{One of the following values:
427 \twocolitem{{\bf wxBITMAP
\_TYPE\_BMP}}{Load a Windows image file.
}
428 \twocolitem{{\bf wxBITMAP
\_TYPE\_GIF}}{Load a GIF image file.
}
429 \twocolitem{{\bf wxBITMAP
\_TYPE\_JPEG}}{Load a JPEG image file.
}
430 \twocolitem{{\bf wxBITMAP
\_TYPE\_PCX}}{Load a PCX image file.
}
431 \twocolitem{{\bf wxBITMAP
\_TYPE\_PNG}}{Load a PNG image file.
}
432 \twocolitem{{\bf wxBITMAP
\_TYPE\_PNM}}{Load a PNM image file.
}
433 \twocolitem{{\bf wxBITMAP
\_TYPE\_TIF}}{Load a TIFF image file.
}
434 \twocolitem{{\bf wxBITMAP
\_TYPE\_ANY}}{Will try to autodetect the format.
}
437 \docparam{mimetype
}{MIME type string (for example 'image/jpeg')
}
441 Depending on how wxWindows has been configured, not all formats may be available.
443 \wxheading{Return value
}
445 TRUE if the operation succeeded, FALSE otherwise.
449 \helpref{wxImage::SaveFile
}{wximagesavefile
}
451 \pythonnote{In place of a single overloaded method name, wxPython
452 implements the following methods:
\par
453 \indented{2cm
}{\begin{twocollist
}
454 \twocolitem{{\bf LoadFile(filename, type)
}}{Loads an image of the given
456 \twocolitem{{\bf LoadMimeFile(filename, mimetype)
}}{Loads an image of the given
457 mimetype from a file
}
462 \membersection{wxImage::Ok
}\label{wximageok
}
464 \constfunc{bool
}{Ok
}{\void}
466 Returns TRUE if image data is present.
468 \membersection{wxImage::RemoveHandler
}
470 \func{static bool
}{RemoveHandler
}{\param{const wxString\&
}{name
}}
472 Finds the handler with the given name, and removes it. The handler
475 \docparam{name
}{The handler name.
}
477 \wxheading{Return value
}
479 TRUE if the handler was found and removed, FALSE otherwise.
483 \helpref{wxImageHandler
}{wximagehandler
}
485 \membersection{wxImage::SaveFile
}\label{wximagesavefile
}
487 \func{bool
}{SaveFile
}{\param{const wxString\&
}{name
},
\param{int
}{ type
}}
489 \func{bool
}{SaveFile
}{\param{const wxString\&
}{name
},
\param{const wxString\&
}{ mimetype
}}
491 Saves a image in the named file.
493 \func{bool
}{SaveFile
}{\param{wxOutputStream\&
}{stream
},
\param{int
}{ type
}}
495 \func{bool
}{SaveFile
}{\param{wxOutputStream\&
}{stream
},
\param{const wxString\&
}{ mimetype
}}
497 Saves a image in the given stream.
499 \wxheading{Parameters
}
501 \docparam{name
}{Name of the file to save the image to.
}
503 \docparam{stream
}{Opened output stream to save the image to.
}
505 \docparam{type
}{Currently three types can be used:
509 \twocolitem{{\bf wxBITMAP
\_TYPE\_JPEG}}{Save a JPEG image file.
}
510 \twocolitem{{\bf wxBITMAP
\_TYPE\_PNG}}{Save a PNG image file.
}
511 \twocolitem{{\bf wxBITMAP
\_TYPE\_PCX}}{Save a PCX image file (tries to save as
8-bit if possible, falls back to
24-bit otherwise).
}
512 \twocolitem{{\bf wxBITMAP
\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).
}
515 \docparam{mimetype
}{MIME type.
}
517 \wxheading{Return value
}
519 TRUE if the operation succeeded, FALSE otherwise.
523 Depending on how wxWindows has been configured, not all formats may be available.
527 \helpref{wxImage::LoadFile
}{wximageloadfile
}
529 \pythonnote{In place of a single overloaded method name, wxPython
530 implements the following methods:
\par
531 \indented{2cm
}{\begin{twocollist
}
532 \twocolitem{{\bf SaveFile(filename, type)
}}{Saves the image using the given
533 type to the named file
}
534 \twocolitem{{\bf SaveMimeFile(filename, mimetype)
}}{Saves the image using the given
535 mimetype to the named file
}
539 \membersection{wxImage::Mirror
}\label{wximagemirror
}
541 \constfunc{wxImage
}{Mirror
}{\param{bool
}{ horizontally = TRUE
}}
543 Returns a mirrored copy of the image. The parameter
{\it horizontally
}
544 indicates the orientation.
546 \membersection{wxImage::Replace
}\label{wximagereplace
}
548 \func{void
}{Replace
}{\param{unsigned char
}{ r1
},
\param{unsigned char
}{ g1
},
\param{unsigned char
}{ b1
},
549 \param{unsigned char
}{ r2
},
\param{unsigned char
}{ g2
},
\param{unsigned char
}{ b2
}}
551 Replaces the colour specified by
{\it r1,g1,b1
} by the colour
{\it r2,g2,b2
}.
553 \membersection{wxImage::Rescale
}\label{wximagerescale
}
555 \func{wxImage \&
}{Rescale
}{\param{int
}{ width
},
\param{int
}{ height
}}
557 Changes the size of the image in-place: after a call to this function, the
558 image will have the given width and height.
560 Returns the (modified) image itself.
564 \helpref{Scale
}{wximagescale
}
566 \membersection{wxImage::Rotate
}\label{wximagerotate
}
568 \func{wxImage
}{Rotate
}{\param{double
}{ angle
},
\param{const wxPoint\&
}{rotationCentre
},
569 \param{bool
}{ interpolating = TRUE
},
\param{wxPoint*
}{ offsetAfterRotation = NULL
}}
571 Rotates the image about the given point, by
{\it angle
} radians. Passing TRUE
572 to
{\it interpolating
} results in better image quality, but is slower. If the
573 image has a mask, then the mask colour is used for the uncovered pixels in the
574 rotated image background. Else, black (rgb
0,
0,
0) will be used.
576 Returns the rotated image, leaving this image intact.
578 \membersection{wxImage::Rotate90
}\label{wximagerotate90
}
580 \constfunc{wxImage
}{Rotate90
}{\param{bool
}{ clockwise = TRUE
}}
582 Returns a copy of the image rotated
90 degrees in the direction
583 indicated by
{\it clockwise
}.
585 \membersection{wxImage::Scale
}\label{wximagescale
}
587 \constfunc{wxImage
}{Scale
}{\param{int
}{ width
},
\param{int
}{ height
}}
589 Returns a scaled version of the image. This is also useful for
590 scaling bitmaps in general as the only other way to scale bitmaps
591 is to blit a wxMemoryDC into another wxMemoryDC.
593 It may be mentioned that the GTK port uses this function internally
594 to scale bitmaps when using mapping modes in wxDC.
599 // get the bitmap from somewhere
602 // rescale it to have size of
32*
32
603 if ( bmp.GetWidth() !=
32 || bmp.GetHeight() !=
32 )
606 bmp = image.Scale(
32,
32).ConvertToBitmap();
608 // another possibility:
609 image.Rescale(
32,
32);
617 \helpref{Rescale
}{wximagerescale
}
619 \membersection{wxImage::SetData
}\label{wximagesetdata
}
621 \func{void
}{SetData
}{\param{unsigned char*
}{data
}}
623 Sets the image data without performing checks. The data given must have
624 the size (width*height*
3) or results will be unexpected. Don't use this
625 method if you aren't sure you know what you are doing.
627 \membersection{wxImage::SetMask
}\label{wximagesetmask
}
629 \func{void
}{SetMask
}{\param{bool
}{ hasMask = TRUE
}}
631 Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
633 \membersection{wxImage::SetMaskColour
}\label{wximagesetmaskcolour
}
635 \func{void
}{SetMaskColour
}{\param{unsigned char
}{red
},
\param{unsigned char
}{blue
},
\param{unsigned char
}{green
}}
637 Sets the mask colour for this image (and tells the image to use the mask).
639 \membersection{wxImage::SetOption
}\label{wximagesetoption
}
641 \func{void
}{SetOption
}{\param{const wxString\&
}{ name
},
\param{const wxString\&
}{ value
}}
643 \func{void
}{SetOption
}{\param{const wxString\&
}{ name
},
\param{int
}{ value
}}
645 Sets a user-defined option. The function is case-insensitive to
{\it name
}.
647 For example, when saving as a JPEG file, the option
{\bf quality
} is
648 used, which is a number between
0 and
100 (
0 is terrible,
100 is very good).
652 \helpref{wxImage::GetOption
}{wximagegetoption
},
\rtfsp
653 \helpref{wxImage::GetOptionInt
}{wximagegetoptionint
},
\rtfsp
654 \helpref{wxImage::HasOption
}{wximagehasoption
}
656 \membersection{wxImage::SetRGB
}\label{wximagesetrgb
}
658 \func{void
}{SetRGB
}{\param{int
}{x
},
\param{int
}{y
},
\param{unsigned char
}{red
},
\param{unsigned char
}{green
},
\param{unsigned char
}{blue
}}
660 Sets the pixel at the given coordinate. This routine performs bounds-checks
661 for the coordinate so it can be considered a safe way to manipulate the
662 data, but in some cases this might be too slow so that the data will have to
663 be set directly. In that case you will have to get access to the image data
664 using the
\helpref{GetData
}{wximagegetdata
} method.
666 \membersection{wxImage::operator $=$
}
668 \func{wxImage\&
}{operator $=$
}{\param{const wxImage\&
}{image
}}
670 Assignment operator. This operator does not copy any data, but instead
671 passes a pointer to the data in
{\it image
} and increments a reference
672 counter. It is a fast operation.
674 \wxheading{Parameters
}
676 \docparam{image
}{Image to assign.
}
678 \wxheading{Return value
}
680 Returns 'this' object.
682 \membersection{wxImage::operator $==$
}
684 \func{bool
}{operator $==$
}{\param{const wxImage\&
}{image
}}
686 Equality operator. This operator tests whether the internal data pointers are
689 \wxheading{Parameters
}
691 \docparam{image
}{Image to compare with 'this'
}
693 \wxheading{Return value
}
695 Returns TRUE if the images were effectively equal, FALSE otherwise.
697 \membersection{wxImage::operator $!=$
}
699 \func{bool
}{operator $!=$
}{\param{const wxImage\&
}{image
}}
701 Inequality operator. This operator tests whether the internal data pointers are
702 unequal (a fast test).
704 \wxheading{Parameters
}
706 \docparam{image
}{Image to compare with 'this'
}
708 \wxheading{Return value
}
710 Returns TRUE if the images were unequal, FALSE otherwise.
712 \section{\class{wxImageHandler
}}\label{wximagehandler
}
714 This is the base class for implementing image file loading/saving, and image creation from data.
715 It is used within wxImage and is not normally seen by the application.
717 If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
718 and add the handler using
\helpref{wxImage::AddHandler
}{wximageaddhandler
} in your
719 application initialisation.
721 \wxheading{Note (Legal Issue)
}
723 This software is based in part on the work of the Independent JPEG Group.
725 (Applies when wxWindows is linked with JPEG support. wxJPEGHandler uses libjpeg
728 \wxheading{Derived from
}
730 \helpref{wxObject
}{wxobject
}
732 \wxheading{Include files
}
738 \helpref{wxImage
}{wximage
},
739 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}
741 \latexignore{\rtfignore{\wxheading{Members
}}}
743 \membersection{wxImageHandler::wxImageHandler
}\label{wximagehandlerconstr
}
745 \func{}{wxImageHandler
}{\void}
747 Default constructor. In your own default constructor, initialise the members
748 m
\_name, m
\_extension and m
\_type.
750 \membersection{wxImageHandler::
\destruct{wxImageHandler
}}
752 \func{}{\destruct{wxImageHandler
}}{\void}
754 Destroys the wxImageHandler object.
756 \membersection{wxImageHandler::GetName
}
758 \constfunc{wxString
}{GetName
}{\void}
760 Gets the name of this handler.
762 \membersection{wxImageHandler::GetExtension
}
764 \constfunc{wxString
}{GetExtension
}{\void}
766 Gets the file extension associated with this handler.
768 \membersection{wxImageHandler::GetImageCount
}\label{wximagehandlergetimagecount
}
770 \func{int
}{GetImageCount
}{\param{wxInputStream\&
}{ stream
}}
772 If the image file contains more than one image and the image handler is capable
773 of retrieving these individually, this function will return the number of
776 \docparam{stream
}{Opened input stream for reading image data. Currently, the stream must support seeking.
}
778 \wxheading{Return value
}
780 Number of available images. For most image handles, this defaults to
1.
782 \membersection{wxImageHandler::GetType
}
784 \constfunc{long
}{GetType
}{\void}
786 Gets the image type associated with this handler.
788 \membersection{wxImageHandler::GetMimeType
}
790 \constfunc{wxString
}{GetMimeType
}{\void}
792 Gets the MIME type associated with this handler.
794 \membersection{wxImageHandler::LoadFile
}\label{wximagehandlerloadfile
}
796 \func{bool
}{LoadFile
}{\param{wxImage*
}{image
},
\param{wxInputStream\&
}{ stream
},
\param{bool
}{ verbose=TRUE
},
\param{int
}{ index=
0}}
798 Loads a image from a stream, putting the resulting data into
{\it image
}. If the image file contains
799 more than one image and the image handler is capable of retrieving these individually,
{\it index
}
800 indicates which image to read from the stream.
802 \wxheading{Parameters
}
804 \docparam{image
}{The image object which is to be affected by this operation.
}
806 \docparam{stream
}{Opened input stream for reading image data.
}
808 \docparam{verbose
}{If set to TRUE, errors reported by the image handler will produce wxLogMessages.
}
810 \docparam{index
}{The index of the image in the file (starting from zero).
}
812 \wxheading{Return value
}
814 TRUE if the operation succeeded, FALSE otherwise.
818 \helpref{wxImage::LoadFile
}{wximageloadfile
},
819 \helpref{wxImage::SaveFile
}{wximagesavefile
},
820 \helpref{wxImageHandler::SaveFile
}{wximagehandlersavefile
}
822 \membersection{wxImageHandler::SaveFile
}\label{wximagehandlersavefile
}
824 \func{bool
}{SaveFile
}{\param{wxImage*
}{image
},
\param{wxOutputStream\&
}{stream
}}
826 Saves a image in the output stream.
828 \wxheading{Parameters
}
830 \docparam{image
}{The image object which is to be affected by this operation.
}
832 \docparam{stream
}{Opened output stream for writing the data.
}
834 \wxheading{Return value
}
836 TRUE if the operation succeeded, FALSE otherwise.
840 \helpref{wxImage::LoadFile
}{wximageloadfile
},
841 \helpref{wxImage::SaveFile
}{wximagesavefile
},
842 \helpref{wxImageHandler::LoadFile
}{wximagehandlerloadfile
}
844 \membersection{wxImageHandler::SetName
}
846 \func{void
}{SetName
}{\param{const wxString\&
}{name
}}
848 Sets the handler name.
850 \wxheading{Parameters
}
852 \docparam{name
}{Handler name.
}
854 \membersection{wxImageHandler::SetExtension
}
856 \func{void
}{SetExtension
}{\param{const wxString\&
}{extension
}}
858 Sets the handler extension.
860 \wxheading{Parameters
}
862 \docparam{extension
}{Handler extension.
}
864 \membersection{wxImageHandler::SetMimeType
}\label{wximagehandlersetmimetype
}
866 \func{void
}{SetMimeType
}{\param{const wxString\&
}{mimetype
}}
868 Sets the handler MIME type.
870 \wxheading{Parameters
}
872 \docparam{mimename
}{Handler MIME type.
}
874 \membersection{wxImageHandler::SetType
}
876 \func{void
}{SetType
}{\param{long
}{type
}}
878 Sets the handler type.
880 \wxheading{Parameters
}
882 \docparam{name
}{Handler type.
}