]>
Commit | Line | Data |
---|---|---|
1e6d9499 JS |
1 | \section{\class{wxImage}}\label{wximage} |
2 | ||
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. | |
8 | ||
9 | A wxImage cannot (currently) be drawn directly to a wxDC. Instead, a platform-specific | |
12a44087 RR |
10 | wxBitmap object must be created from it, and that bitmap drawn on the wxDC, using |
11 | wxDC::DrawBitmap. | |
12 | ||
1e6d9499 JS |
13 | \wxheading{Derived from} |
14 | ||
15 | \helpref{wxObject}{wxobject} | |
16 | ||
954b8ae6 JS |
17 | \wxheading{Include files} |
18 | ||
19 | <wx/image.h> | |
20 | ||
1e6d9499 JS |
21 | \wxheading{See also} |
22 | ||
23 | \helpref{wxBitmap}{wxbitmap} | |
b5a4a47d | 24 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
25 | |
26 | \latexignore{\rtfignore{\wxheading{Members}}} | |
27 | ||
28 | \membersection{wxImage::wxImage}\label{wximageconstr} | |
29 | ||
30 | \func{}{wxImage}{\void} | |
31 | ||
32 | Default constructor. | |
33 | ||
34 | \func{}{wxImage}{\param{const wxImage\& }{image}} | |
35 | ||
36 | Copy constructor. | |
37 | ||
38 | \func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}} | |
39 | ||
12a44087 RR |
40 | Constructs an image from a platform-dependent bitmap. This preserves |
41 | mask information so that bitmaps and images can be converted back | |
42 | and forth without loss in that respect. | |
1e6d9499 JS |
43 | |
44 | \func{}{wxImage}{\param{int}{ width}, \param{int}{ height}} | |
45 | ||
46 | Creates an image with the given width and height. | |
47 | ||
f6fcbb63 | 48 | \func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_PNG}} |
1e6d9499 | 49 | |
9e9ee68e VS |
50 | \func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}} |
51 | ||
1e6d9499 JS |
52 | Loads an image from a file. |
53 | ||
f6fcbb63 | 54 | \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxBITMAP\_TYPE\_PNG}} |
45b5751f | 55 | |
9e9ee68e VS |
56 | \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{const wxString\&}{ mimetype}} |
57 | ||
45b5751f JS |
58 | Loads an image from an input stream. |
59 | ||
1e6d9499 JS |
60 | \wxheading{Parameters} |
61 | ||
62 | \docparam{width}{Specifies the width of the image.} | |
63 | ||
64 | \docparam{height}{Specifies the height of the image.} | |
65 | ||
66 | \docparam{name}{This refers to an image filename. Its meaning is determined by the {\it type} parameter.} | |
67 | ||
45b5751f JS |
68 | \docparam{stream}{This refers to an input stream. Its meaning is determined by the {\it type} parameter. It is equal to loading from file except that you provide opened stream (file, HTTP or any other custom class).} |
69 | ||
1e6d9499 JS |
70 | \docparam{type}{May be one of the following: |
71 | ||
6be663cf | 72 | \twocolwidtha{5cm}% |
1e6d9499 | 73 | \begin{twocollist} |
f6fcbb63 RR |
74 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP}}}{Load a Windows bitmap file.} |
75 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_PNG}}}{Load a PNG bitmap file.} | |
48b4e302 | 76 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_JPEG}}}{Load a JPEG bitmap file.} |
1e6d9499 JS |
77 | \end{twocollist} |
78 | ||
79 | The validity of these flags depends on the platform and wxWindows configuration. | |
48b4e302 VS |
80 | If all possible wxWindows settings are used, the loading a BMP (Windows bitmap) file, |
81 | a PNG (portable network graphics) file and a JPEG file is supported on all platforms that | |
12a44087 | 82 | implement wxImage.} |
1e6d9499 | 83 | |
9e9ee68e VS |
84 | \docparam{mimetype}{MIME type string (for example 'image/jpeg')} |
85 | ||
f899db6d | 86 | Note : you must call wxImage::AddHandler(new wxJPEGHandler) during application |
0a9f2522 VS |
87 | initialization in order to work with JPEGs. |
88 | ||
1e6d9499 JS |
89 | \wxheading{See also} |
90 | ||
91 | \helpref{wxImage::LoadFile}{wximageloadfile} | |
92 | ||
f899db6d RD |
93 | \pythonnote{Constructors supported by wxPython are:\par |
94 | \indented{2cm}{\begin{twocollist} | |
95 | \twocolitem{\bf{wxImage(name, flag)}}{Loads an image from a file} | |
96 | \twocolitem{\bf{wxNullImage()}}{Create a null image (has no size or | |
97 | image data)} | |
98 | \twocolitem{\bf{wxEmptyImage(width, height)}}{Creates an empty image | |
99 | of the given size} | |
100 | \twocolitem{\bf{wxImageFromMime(name, mimetype}}{Creates an image from | |
101 | the given file of the given mimetype} | |
102 | \twocolitem{\bf{wxImageFromBitmap(bitmap)}}{Creates an image from a | |
103 | platform-dependent bitmap} | |
104 | \end{twocollist}} | |
105 | } | |
106 | ||
1e6d9499 JS |
107 | \membersection{wxImage::\destruct{wxImage}} |
108 | ||
109 | \func{}{\destruct{wxImage}}{\void} | |
110 | ||
111 | Destructor. | |
112 | ||
113 | \membersection{wxImage::AddHandler}\label{wximageaddhandler} | |
114 | ||
115 | \func{static void}{AddHandler}{\param{wxImageHandler*}{ handler}} | |
116 | ||
117 | Adds a handler to the end of the static list of format handlers. | |
118 | ||
119 | \docparam{handler}{A new image format handler object. There is usually only one instance | |
120 | of a given handler class in an application session.} | |
121 | ||
122 | \wxheading{See also} | |
123 | ||
124 | \helpref{wxImageHandler}{wximagehandler} | |
125 | ||
f899db6d | 126 | \pythonnote{In wxPython this static method is named \tt{wxImage_AddHandler}.} |
1e6d9499 JS |
127 | \membersection{wxImage::CleanUpHandlers} |
128 | ||
129 | \func{static void}{CleanUpHandlers}{\void} | |
130 | ||
131 | Deletes all image handlers. | |
132 | ||
133 | This function is called by wxWindows on exit. | |
134 | ||
135 | \membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap} | |
136 | ||
137 | \constfunc{wxBitmap}{ConvertToBitmap}{\void} | |
138 | ||
12a44087 RR |
139 | Converts the image to a platform-specific bitmap object. This has to be done |
140 | to actually display an image as you cannot draw an image directly on a window. | |
141 | The resulting bitmap will use the colour depth of the current system which entails | |
f6fcbb63 RR |
142 | that a (crude) colour reduction has to take place. When in 8-bit mode, this |
143 | routine will use a color cube created on program start-up to look up colors. | |
144 | Still, the image quality won't be perfect for photo images. | |
1e6d9499 JS |
145 | |
146 | \membersection{wxImage::Create}\label{wximagecreate} | |
147 | ||
148 | \func{bool}{Create}{\param{int}{ width}, \param{int}{ height}} | |
149 | ||
150 | Creates a fresh image. | |
151 | ||
152 | \wxheading{Parameters} | |
153 | ||
154 | \docparam{width}{The width of the image in pixels.} | |
155 | ||
156 | \docparam{height}{The height of the image in pixels.} | |
157 | ||
158 | \wxheading{Return value} | |
159 | ||
160 | TRUE if the call succeeded, FALSE otherwise. | |
161 | ||
162 | \membersection{wxImage::Destroy}\label{wximagedestroy} | |
163 | ||
164 | \func{bool}{Destroy}{\void} | |
165 | ||
166 | Destroys the image data. | |
167 | ||
168 | \membersection{wxImage::FindHandler} | |
169 | ||
170 | \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
171 | ||
172 | Finds the handler with the given name. | |
173 | ||
174 | \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}} | |
175 | ||
176 | Finds the handler associated with the given extension and type. | |
177 | ||
178 | \func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}} | |
179 | ||
180 | Finds the handler associated with the given image type. | |
181 | ||
9e9ee68e VS |
182 | \func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}} |
183 | ||
184 | Finds the handler associated with the given MIME type. | |
185 | ||
1e6d9499 JS |
186 | \docparam{name}{The handler name.} |
187 | ||
188 | \docparam{extension}{The file extension, such as ``bmp".} | |
189 | ||
f6fcbb63 | 190 | \docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.} |
1e6d9499 | 191 | |
9e9ee68e VS |
192 | \docparam{mimetype}{MIME type.} |
193 | ||
1e6d9499 JS |
194 | \wxheading{Return value} |
195 | ||
196 | A pointer to the handler if found, NULL otherwise. | |
197 | ||
198 | \wxheading{See also} | |
199 | ||
200 | \helpref{wxImageHandler}{wximagehandler} | |
201 | ||
202 | \membersection{wxImage::GetBlue}\label{wximagegetblue} | |
203 | ||
204 | \constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}} | |
205 | ||
206 | Returns the blue intensity at the given coordinate. | |
207 | ||
208 | \membersection{wxImage::GetData}\label{wximagegetdata} | |
209 | ||
210 | \constfunc{unsigned char*}{GetData}{\void} | |
211 | ||
12a44087 RR |
212 | Returns the image data as an array. This is most often used when doing |
213 | direct image manipulation. The return value points to an array of | |
214 | chararcters in RGBGBRGB... format. | |
1e6d9499 JS |
215 | |
216 | \membersection{wxImage::GetGreen}\label{wximagegetgreen} | |
217 | ||
218 | \constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}} | |
219 | ||
220 | Returns the green intensity at the given coordinate. | |
221 | ||
222 | \membersection{wxImage::GetRed}\label{wximagegetred} | |
223 | ||
224 | \constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}} | |
225 | ||
226 | Returns the red intensity at the given coordinate. | |
227 | ||
228 | \membersection{wxImage::GetHandlers} | |
229 | ||
230 | \func{static wxList\&}{GetHandlers}{\void} | |
231 | ||
232 | Returns the static list of image format handlers. | |
233 | ||
234 | \wxheading{See also} | |
235 | ||
236 | \helpref{wxImageHandler}{wximagehandler} | |
237 | ||
238 | \membersection{wxImage::GetHeight}\label{wximagegetheight} | |
239 | ||
240 | \constfunc{int}{GetHeight}{\void} | |
241 | ||
242 | Gets the height of the image in pixels. | |
243 | ||
244 | \membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue} | |
245 | ||
246 | \constfunc{unsigned char}{GetMaskBlue}{\void} | |
247 | ||
248 | Gets the blue value of the mask colour. | |
249 | ||
250 | \membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen} | |
251 | ||
252 | \constfunc{unsigned char}{GetMaskGreen}{\void} | |
253 | ||
254 | Gets the green value of the mask colour. | |
255 | ||
256 | \membersection{wxImage::GetMaskRed}\label{wximagegetmaskred} | |
257 | ||
258 | \constfunc{unsigned char}{GetMaskRed}{\void} | |
259 | ||
260 | Gets the red value of the mask colour. | |
261 | ||
262 | \membersection{wxImage::GetWidth}\label{wximagegetwidth} | |
263 | ||
264 | \constfunc{int}{GetWidth}{\void} | |
265 | ||
266 | Gets the width of the image in pixels. | |
267 | ||
268 | \wxheading{See also} | |
269 | ||
270 | \helpref{wxImage::GetHeight}{wximagegetheight} | |
271 | ||
272 | \membersection{wxImage::HasMask}\label{wximagehasmask} | |
273 | ||
274 | \constfunc{bool}{HasMask}{\void} | |
275 | ||
276 | Returns TRUE if there is a mask active, FALSE otherwise. | |
277 | ||
278 | \membersection{wxImage::InitStandardHandlers} | |
279 | ||
280 | \func{static void}{InitStandardHandlers}{\void} | |
281 | ||
a14e57f9 SB |
282 | Internal use only. Adds standard image format handlers. It only install BMP |
283 | for the time being, which is use by wxBitmap. | |
1e6d9499 | 284 | |
a14e57f9 SB |
285 | This function is called by wxWindows on startup, and shouldn't be called by |
286 | the user. | |
1e6d9499 JS |
287 | |
288 | \wxheading{See also} | |
289 | ||
290 | \helpref{wxImageHandler}{wximagehandler} | |
b5a4a47d | 291 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
292 | |
293 | \membersection{wxImage::InsertHandler} | |
294 | ||
295 | \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}} | |
296 | ||
297 | Adds a handler at the start of the static list of format handlers. | |
298 | ||
299 | \docparam{handler}{A new image format handler object. There is usually only one instance | |
300 | of a given handler class in an application session.} | |
301 | ||
302 | \wxheading{See also} | |
303 | ||
304 | \helpref{wxImageHandler}{wximagehandler} | |
305 | ||
306 | \membersection{wxImage::LoadFile}\label{wximageloadfile} | |
307 | ||
a14e57f9 | 308 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}} |
1e6d9499 | 309 | |
9e9ee68e VS |
310 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}} |
311 | ||
a14e57f9 SB |
312 | Loads an image from a file. If no handler type is provided, the library will |
313 | try to use wxBITMAP\_TYPE\_BMP or all known handlers previously installed | |
314 | through a call to \helpref{wxImage::InitAllHandlers}{wximageinitallhandlers}. | |
1e6d9499 | 315 | |
45b5751f JS |
316 | \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}} |
317 | ||
9e9ee68e VS |
318 | \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}} |
319 | ||
45b5751f JS |
320 | Loads an image from an input stream. |
321 | ||
1e6d9499 JS |
322 | \wxheading{Parameters} |
323 | ||
324 | \docparam{name}{A filename. | |
325 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
326 | ||
45b5751f JS |
327 | \docparam{stream}{An input stream. |
328 | The meaning of {\it stream} data is determined by the {\it type} parameter.} | |
329 | ||
1e6d9499 JS |
330 | \docparam{type}{One of the following values: |
331 | ||
6be663cf | 332 | \twocolwidtha{5cm}% |
1e6d9499 | 333 | \begin{twocollist} |
f6fcbb63 | 334 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.} |
a14e57f9 | 335 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.} |
48b4e302 | 336 | \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.} |
a14e57f9 SB |
337 | \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.} |
338 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.} | |
339 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.} | |
1e6d9499 JS |
340 | \end{twocollist} |
341 | ||
342 | The validity of these flags depends on the platform and wxWindows configuration.} | |
343 | ||
9e9ee68e VS |
344 | \docparam{mimetype}{MIME type string (for example 'image/jpeg')} |
345 | ||
1e6d9499 JS |
346 | \wxheading{Return value} |
347 | ||
348 | TRUE if the operation succeeded, FALSE otherwise. | |
349 | ||
350 | \wxheading{See also} | |
351 | ||
352 | \helpref{wxImage::SaveFile}{wximagesavefile} | |
353 | ||
f899db6d RD |
354 | \pythonnote{In place of a single overloaded method name, wxPython |
355 | implements the following methods:\par | |
356 | \indented{2cm}{\begin{twocollist} | |
357 | \twocolitem{\bf{LoadFile(filename, type)}}{Loads an image of the given | |
358 | type from a file} | |
359 | \twocolitem{\bf{LoadMimeFile(filename, mimetype)}}{Loads an image of the given | |
360 | mimetype from a file} | |
361 | \end{twocollist}} | |
362 | } | |
363 | ||
364 | ||
1e6d9499 JS |
365 | \membersection{wxImage::Ok}\label{wximageok} |
366 | ||
367 | \constfunc{bool}{Ok}{\void} | |
368 | ||
369 | Returns TRUE if image data is present. | |
370 | ||
371 | \membersection{wxImage::RemoveHandler} | |
372 | ||
373 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
374 | ||
375 | Finds the handler with the given name, and removes it. The handler | |
376 | is not deleted. | |
377 | ||
378 | \docparam{name}{The handler name.} | |
379 | ||
380 | \wxheading{Return value} | |
381 | ||
382 | TRUE if the handler was found and removed, FALSE otherwise. | |
383 | ||
384 | \wxheading{See also} | |
385 | ||
386 | \helpref{wxImageHandler}{wximagehandler} | |
387 | ||
388 | \membersection{wxImage::SaveFile}\label{wximagesavefile} | |
389 | ||
390 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}} | |
391 | ||
9e9ee68e VS |
392 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}} |
393 | ||
1e6d9499 JS |
394 | Saves a image in the named file. |
395 | ||
45b5751f JS |
396 | \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}} |
397 | ||
9e9ee68e VS |
398 | \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}} |
399 | ||
45b5751f JS |
400 | Saves a image in the given stream. |
401 | ||
1e6d9499 JS |
402 | \wxheading{Parameters} |
403 | ||
404 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
405 | ||
45b5751f JS |
406 | \docparam{stream}{An output stream. The meaning of {\it stream} is determined by the {\it type} parameter.} |
407 | ||
48b4e302 | 408 | \docparam{type}{Currently two types can be used: |
1e6d9499 | 409 | |
6be663cf | 410 | \twocolwidtha{5cm}% |
1e6d9499 | 411 | \begin{twocollist} |
f6fcbb63 | 412 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.} |
48b4e302 | 413 | \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.} |
1e6d9499 JS |
414 | \end{twocollist} |
415 | ||
12a44087 RR |
416 | The validity of these flags depends on the platform and wxWindows configuration |
417 | as well as user-added handlers.} | |
1e6d9499 | 418 | |
9e9ee68e VS |
419 | \docparam{mimetype}{MIME type.} |
420 | ||
1e6d9499 JS |
421 | \wxheading{Return value} |
422 | ||
423 | TRUE if the operation succeeded, FALSE otherwise. | |
424 | ||
425 | \wxheading{Remarks} | |
426 | ||
427 | Depending on how wxWindows has been configured, not all formats may be available. | |
428 | ||
429 | \wxheading{See also} | |
430 | ||
431 | \helpref{wxImage::LoadFile}{wximageloadfile} | |
432 | ||
f899db6d RD |
433 | \pythonnote{In place of a single overloaded method name, wxPython |
434 | implements the following methods:\par | |
435 | \indented{2cm}{\begin{twocollist} | |
436 | \twocolitem{\bf{SaveFile(filename, type)}}{Saves the image using the given | |
437 | type to the named file} | |
438 | \twocolitem{\bf{SaveMimeFile(filename, mimetype)}}{Saves the image using the given | |
439 | mimetype to the named file} | |
440 | \end{twocollist}} | |
441 | } | |
442 | ||
ce9a75d2 VZ |
443 | \membersection{wxImage::Rescale}\label{wximagerescale} |
444 | ||
445 | \func{wxImage}{Rescale}{\param{int}{ width}, \param{int}{ height}} | |
446 | ||
9c884972 RR |
447 | Changes the size of the image in-place: after a call to this function, the |
448 | image will have the given width and height. | |
ce9a75d2 VZ |
449 | |
450 | \wxheading{See also} | |
451 | ||
452 | \helpref{Scale}{wximagescale} | |
453 | ||
1e6d9499 JS |
454 | \membersection{wxImage::Scale}\label{wximagescale} |
455 | ||
ce9a75d2 | 456 | \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}} |
1e6d9499 | 457 | |
12a44087 RR |
458 | Returns a scaled version of the image. This is also useful for |
459 | scaling bitmaps in general as the only other way to scale bitmaps | |
ce9a75d2 VZ |
460 | is to blit a wxMemoryDC into another wxMemoryDC. |
461 | ||
462 | NB: although Windows can do such scaling itself but in the GTK port, scaling | |
463 | bitmaps is done using this routine internally. | |
464 | ||
465 | Example: | |
466 | ||
467 | \begin{verbatim} | |
468 | // get the bitmap from somewhere | |
469 | wxBitmap bmp = ...; | |
470 | ||
471 | // rescale it to have size of 32*32 | |
472 | if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 ) | |
473 | { | |
474 | wxImage image(bmp); | |
475 | bmp = image.Scale(32, 32).ConvertToBitmap(); | |
476 | ||
477 | // another possibility: | |
478 | image.Rescale(32, 32); | |
479 | bmp = image; | |
480 | } | |
481 | ||
482 | \end{verbatim} | |
483 | ||
484 | \wxheading{See also} | |
485 | ||
486 | \helpref{Rescale}{wximagerescale} | |
1e6d9499 | 487 | |
7b2471a0 SB |
488 | \membersection{wxImage::GetSubImage}\label{wximagegetsubimage} |
489 | ||
490 | \constfunc{wxImage}{GetSubImage}{\param{const wxRect&}{rect}} | |
491 | ||
492 | Returns a sub image of the current one as long as the rect belongs entirely to | |
493 | the image. | |
494 | ||
1e6d9499 JS |
495 | \membersection{wxImage::SetData}\label{wximagesetdata} |
496 | ||
497 | \func{void}{SetData}{\param{unsigned char*}{data}} | |
498 | ||
f899db6d | 499 | Sets the image data without performing checks. The data given must have |
12a44087 RR |
500 | the size (width*height*3) or results will be unexpected. Don't use this |
501 | method if you aren't sure you know what you are doing. | |
1e6d9499 JS |
502 | |
503 | \membersection{wxImage::SetMask}\label{wximagesetmask} | |
504 | ||
505 | \func{void}{SetMask}{\param{bool}{ hasMask = TRUE}} | |
506 | ||
507 | Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour. | |
508 | ||
509 | \membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour} | |
510 | ||
511 | \func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}} | |
512 | ||
b1170810 | 513 | Sets the mask colour for this image (and tells the image to use the mask). |
1e6d9499 JS |
514 | |
515 | \membersection{wxImage::SetRGB}\label{wximagesetrgb} | |
516 | ||
517 | \func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}} | |
518 | ||
12a44087 RR |
519 | Sets the pixel at the given coordinate. This routine performs bounds-checks |
520 | for the coordinate so it can be considered a safe way to manipulate the | |
521 | data, but in some cases this might be too slow so that the data will have to | |
522 | be set directly. In that case you have to get that data by calling GetData(). | |
1e6d9499 JS |
523 | |
524 | \membersection{wxImage::operator $=$} | |
525 | ||
526 | \func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}} | |
527 | ||
528 | Assignment operator. This operator does not copy any data, but instead | |
529 | passes a pointer to the data in {\it image} and increments a reference | |
530 | counter. It is a fast operation. | |
531 | ||
532 | \wxheading{Parameters} | |
533 | ||
534 | \docparam{image}{Image to assign.} | |
535 | ||
536 | \wxheading{Return value} | |
537 | ||
538 | Returns 'this' object. | |
539 | ||
540 | \membersection{wxImage::operator $==$} | |
541 | ||
542 | \func{bool}{operator $==$}{\param{const wxImage\& }{image}} | |
543 | ||
544 | Equality operator. This operator tests whether the internal data pointers are | |
545 | equal (a fast test). | |
546 | ||
547 | \wxheading{Parameters} | |
548 | ||
549 | \docparam{image}{Image to compare with 'this'} | |
550 | ||
551 | \wxheading{Return value} | |
552 | ||
553 | Returns TRUE if the images were effectively equal, FALSE otherwise. | |
554 | ||
555 | \membersection{wxImage::operator $!=$} | |
556 | ||
557 | \func{bool}{operator $!=$}{\param{const wxImage\& }{image}} | |
558 | ||
559 | Inequality operator. This operator tests whether the internal data pointers are | |
560 | unequal (a fast test). | |
561 | ||
562 | \wxheading{Parameters} | |
563 | ||
564 | \docparam{image}{Image to compare with 'this'} | |
565 | ||
566 | \wxheading{Return value} | |
567 | ||
568 | Returns TRUE if the images were unequal, FALSE otherwise. | |
569 | ||
570 | \section{\class{wxImageHandler}}\label{wximagehandler} | |
571 | ||
1e6d9499 JS |
572 | This is the base class for implementing image file loading/saving, and image creation from data. |
573 | It is used within wxImage and is not normally seen by the application. | |
574 | ||
575 | If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler | |
576 | and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your | |
577 | application initialisation. | |
578 | ||
48b4e302 VS |
579 | \wxheading{Note (Legal Issue)} |
580 | ||
954b8ae6 | 581 | This software is based in part on the work of the Independent JPEG Group. |
48b4e302 VS |
582 | |
583 | (Applies when wxWindows is linked with JPEG support. wxJPEGHandler uses libjpeg | |
584 | created by IJG.) | |
585 | ||
1e6d9499 JS |
586 | \wxheading{Derived from} |
587 | ||
588 | \helpref{wxObject}{wxobject} | |
589 | ||
954b8ae6 JS |
590 | \wxheading{Include files} |
591 | ||
592 | <wx/image.h> | |
593 | ||
1e6d9499 JS |
594 | \wxheading{See also} |
595 | ||
596 | \helpref{wxImage}{wximage} | |
b5a4a47d | 597 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
598 | |
599 | \latexignore{\rtfignore{\wxheading{Members}}} | |
600 | ||
601 | \membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerconstr} | |
602 | ||
603 | \func{}{wxImageHandler}{\void} | |
604 | ||
605 | Default constructor. In your own default constructor, initialise the members | |
606 | m\_name, m\_extension and m\_type. | |
607 | ||
608 | \membersection{wxImageHandler::\destruct{wxImageHandler}} | |
609 | ||
610 | \func{}{\destruct{wxImageHandler}}{\void} | |
611 | ||
612 | Destroys the wxImageHandler object. | |
613 | ||
614 | \membersection{wxImageHandler::GetName} | |
615 | ||
616 | \constfunc{wxString}{GetName}{\void} | |
617 | ||
618 | Gets the name of this handler. | |
619 | ||
620 | \membersection{wxImageHandler::GetExtension} | |
621 | ||
622 | \constfunc{wxString}{GetExtension}{\void} | |
623 | ||
624 | Gets the file extension associated with this handler. | |
625 | ||
626 | \membersection{wxImageHandler::GetType} | |
627 | ||
628 | \constfunc{long}{GetType}{\void} | |
629 | ||
630 | Gets the image type associated with this handler. | |
631 | ||
9e9ee68e VS |
632 | \membersection{wxImageHandler::GetMimeType} |
633 | ||
634 | \constfunc{wxString}{GetMimeType}{\void} | |
635 | ||
636 | Gets the MIME type associated with this handler. | |
637 | ||
1e6d9499 JS |
638 | \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile} |
639 | ||
45b5751f | 640 | \func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}} |
1e6d9499 | 641 | |
45b5751f | 642 | Loads a image from a stream, putting the resulting data into {\it image}. |
1e6d9499 JS |
643 | |
644 | \wxheading{Parameters} | |
645 | ||
646 | \docparam{image}{The image object which is to be affected by this operation.} | |
647 | ||
45b5751f JS |
648 | \docparam{stream}{Opened input stream. |
649 | The meaning of {\it stream} is determined by the {\it type} parameter.} | |
1e6d9499 JS |
650 | |
651 | \wxheading{Return value} | |
652 | ||
653 | TRUE if the operation succeeded, FALSE otherwise. | |
654 | ||
655 | \wxheading{See also} | |
656 | ||
657 | \helpref{wxImage::LoadFile}{wximageloadfile}\\ | |
658 | \helpref{wxImage::SaveFile}{wximagesavefile}\\ | |
659 | \helpref{wxImageHandler::SaveFile}{wximagehandlersavefile} | |
660 | ||
661 | \membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile} | |
662 | ||
45b5751f | 663 | \func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}} |
1e6d9499 | 664 | |
45b5751f | 665 | Saves a image in the output stream. |
1e6d9499 JS |
666 | |
667 | \wxheading{Parameters} | |
668 | ||
669 | \docparam{image}{The image object which is to be affected by this operation.} | |
670 | ||
45b5751f | 671 | \docparam{stream}{A stream. The meaning of {\it stream} is determined by the {\it type} parameter.} |
1e6d9499 JS |
672 | |
673 | \wxheading{Return value} | |
674 | ||
675 | TRUE if the operation succeeded, FALSE otherwise. | |
676 | ||
677 | \wxheading{See also} | |
678 | ||
679 | \helpref{wxImage::LoadFile}{wximageloadfile}\\ | |
680 | \helpref{wxImage::SaveFile}{wximagesavefile}\\ | |
681 | \helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile} | |
682 | ||
683 | \membersection{wxImageHandler::SetName} | |
684 | ||
685 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
686 | ||
687 | Sets the handler name. | |
688 | ||
689 | \wxheading{Parameters} | |
690 | ||
691 | \docparam{name}{Handler name.} | |
692 | ||
693 | \membersection{wxImageHandler::SetExtension} | |
694 | ||
695 | \func{void}{SetExtension}{\param{const wxString\& }{extension}} | |
696 | ||
697 | Sets the handler extension. | |
698 | ||
699 | \wxheading{Parameters} | |
700 | ||
701 | \docparam{extension}{Handler extension.} | |
702 | ||
703 | \membersection{wxImageHandler::SetType} | |
704 | ||
705 | \func{void}{SetType}{\param{long }{type}} | |
706 | ||
707 | Sets the handler type. | |
708 | ||
709 | \wxheading{Parameters} | |
710 | ||
711 | \docparam{name}{Handler type.} | |
712 | ||
9e9ee68e VS |
713 | |
714 | \membersection{wxImageHandler::SetMimeType} | |
715 | ||
716 | \func{void}{SetMimeType}{\param{const wxString\& }{mimetype}} | |
717 | ||
718 | Sets the handler MIME type. | |
719 | ||
720 | \wxheading{Parameters} | |
721 | ||
722 | \docparam{mimename}{Handler MIME type.} | |
723 |