1wxImage(3)                 Erlang Module Definition                 wxImage(3)
2
3
4

NAME

6       wxImage - Functions for wxImage class
7

DESCRIPTION

9       This class encapsulates a platform-independent image.
10
11       An  image can be created from data, or using wxBitmap:convertToImage/1.
12       An image can be loaded from a file in a variety of formats, and is  ex‐
13       tensible to new formats via image format handlers. Functions are avail‐
14       able to set and get image bits, so it can be used for basic  image  ma‐
15       nipulation.
16
17       A  wxImage  cannot  (currently) be drawn directly to a wxDC. Instead, a
18       platform-specific wxBitmap object must be created  from  it  using  the
19       wxBitmap::wxBitmap(wxImage,int depth) constructor. This bitmap can then
20       be drawn in a device context, using wxDC:drawBitmap/4.
21
22       More on the difference between wxImage and wxBitmap: wxImage is just  a
23       buffer  of RGB bytes with an optional buffer for the alpha bytes. It is
24       all generic, platform independent and  image  file  format  independent
25       code.  It  includes  generic  code for scaling, resizing, clipping, and
26       other manipulations of the image data. OTOH, wxBitmap is intended to be
27       a wrapper of whatever is the native image format that is quickest/easi‐
28       est to draw to a DC or to be the target of the drawing operations  per‐
29       formed on a wxMemoryDC. By splitting the responsibilities between wxIm‐
30       age/wxBitmap like this then it's easier to use generic code  shared  by
31       all  platforms and image types for generic operations and platform spe‐
32       cific code where performance or compatibility is needed.
33
34       One colour value of the image may be used as a mask colour  which  will
35       lead  to  the  automatic  creation of a wxMask object associated to the
36       bitmap object.
37
38       Alpha channel support
39
40       Starting from wxWidgets 2.5.0 wxImage supports alpha channel data, that
41       is  in addition to a byte for the red, green and blue colour components
42       for each pixel it also stores a byte representing the pixel opacity.
43
44       An alpha value of 0 corresponds to a transparent pixel  (null  opacity)
45       while a value of 255 means that the pixel is 100% opaque. The constants
46       ?wxIMAGE_ALPHA_TRANSPARENT and ?wxIMAGE_ALPHA_OPAQUE can be used to in‐
47       dicate those values in a more readable form.
48
49       While  all  images have RGB data, not all images have an alpha channel.
50       Before using getAlpha/3 you should check if this image contains an  al‐
51       pha channel with hasAlpha/1. Currently the BMP, PNG, TGA, and TIFF for‐
52       mat handlers have full alpha channel support for loading so if you want
53       to  use  alpha  you have to use one of these formats. If you initialize
54       the image alpha channel yourself using setAlpha/4, you should  save  it
55       in  either PNG, TGA, or TIFF format to avoid losing it as these are the
56       only handlers that currently support saving with alpha.
57
58       Available image handlers
59
60       The following image handlers are available. wxBMPHandler is always  in‐
61       stalled by default. To use other image formats, install the appropriate
62       handler with wxImage::AddHandler (not implemented in wx) or  call  ?wx‐
63       InitAllImageHandlers().
64
65       When  saving  in  PCX format, wxPCXHandler (not implemented in wx) will
66       count the number of different colours in the image; if there are 256 or
67       less colours, it will save as 8 bit, else it will save as 24 bit.
68
69       Loading PNMs only works for ASCII or raw RGB images. When saving in PNM
70       format, wxPNMHandler (not implemented in wx) will always  save  as  raw
71       RGB.
72
73       Saving  GIFs  requires images of maximum 8 bpp (see wxQuantize (not im‐
74       plemented in wx)), and the alpha channel converted to a mask (see  con‐
75       vertAlphaToMask/5).  Saving an animated GIF requires images of the same
76       size (see wxGIFHandler::SaveAnimation (not implemented in wx))
77
78       Predefined objects (include wx.hrl): ?wxNullImage
79
80       See: wxBitmap, ?wxInitAllImageHandlers(), wxPixelData (not  implemented
81       in wx)
82
83       wxWidgets docs: wxImage
84

DATA TYPES

86       wxImage() = wx:wx_object()
87

EXPORTS

89       new() -> wxImage()
90
91              Creates an empty wxImage object without an alpha channel.
92
93       new(Name) -> wxImage()
94
95       new(Sz) -> wxImage()
96
97              Types:
98
99                 Sz = {W :: integer(), H :: integer()}
100
101       new(Width, Height) -> wxImage()
102
103       new(Name, Height :: [Option]) -> wxImage()
104
105       new(Sz, Data) -> wxImage()
106
107       new(Sz, Height :: [Option]) -> wxImage()
108
109              Types:
110
111                 Sz = {W :: integer(), H :: integer()}
112                 Option = {clear, boolean()}
113
114              This is an overloaded member function, provided for convenience.
115              It differs from the above function only in what  argument(s)  it
116              accepts.
117
118       new(Width, Height, Data) -> wxImage()
119
120       new(Width, Height, Data :: [Option]) -> wxImage()
121
122       new(Name, Mimetype, Data :: [Option]) -> wxImage()
123
124       new(Sz, Data, Alpha) -> wxImage()
125
126              Types:
127
128                 Sz = {W :: integer(), H :: integer()}
129                 Data = Alpha = binary()
130
131              This is an overloaded member function, provided for convenience.
132              It differs from the above function only in what  argument(s)  it
133              accepts.
134
135       new(Width, Height, Data, Alpha) -> wxImage()
136
137              Types:
138
139                 Width = Height = integer()
140                 Data = Alpha = binary()
141
142              Creates an image from data in memory.
143
144              If  static_data is false then the wxImage will take ownership of
145              the data and free it afterwards. For this, it has  to  be  allo‐
146              cated with malloc.
147
148       destroy(This :: wxImage()) -> ok
149
150              Destructor.
151
152              See reference-counted object destruction for more info.
153
154       blur(This, BlurRadius) -> wxImage()
155
156              Types:
157
158                 This = wxImage()
159                 BlurRadius = integer()
160
161              Blurs  the  image  in both horizontal and vertical directions by
162              the specified pixel blurRadius.
163
164              This should not be used when using  a  single  mask  colour  for
165              transparency.
166
167              See: blurHorizontal/2, blurVertical/2
168
169       blurHorizontal(This, BlurRadius) -> wxImage()
170
171              Types:
172
173                 This = wxImage()
174                 BlurRadius = integer()
175
176              Blurs the image in the horizontal direction only.
177
178              This  should  not  be  used  when using a single mask colour for
179              transparency.
180
181              See: blur/2, blurVertical/2
182
183       blurVertical(This, BlurRadius) -> wxImage()
184
185              Types:
186
187                 This = wxImage()
188                 BlurRadius = integer()
189
190              Blurs the image in the vertical direction only.
191
192              This should not be used when using  a  single  mask  colour  for
193              transparency.
194
195              See: blur/2, blurHorizontal/2
196
197       convertAlphaToMask(This) -> boolean()
198
199              Types:
200
201                 This = wxImage()
202
203       convertAlphaToMask(This, Options :: [Option]) -> boolean()
204
205              Types:
206
207                 This = wxImage()
208                 Option = {threshold, integer()}
209
210              If the image has alpha channel, this method converts it to mask.
211
212              If  the  image has an alpha channel, all pixels with alpha value
213              less than threshold are replaced with the mask  colour  and  the
214              alpha channel is removed. Otherwise nothing is done.
215
216              The  mask  colour is chosen automatically using findFirstUnused‐
217              Colour/2, see the overload below if this is not appropriate.
218
219              Return: Returns true on success, false on error.
220
221       convertAlphaToMask(This, Mr, Mg, Mb) -> boolean()
222
223              Types:
224
225                 This = wxImage()
226                 Mr = Mg = Mb = integer()
227
228       convertAlphaToMask(This, Mr, Mg, Mb, Options :: [Option]) ->
229                             boolean()
230
231              Types:
232
233                 This = wxImage()
234                 Mr = Mg = Mb = integer()
235                 Option = {threshold, integer()}
236
237              If the image has alpha channel, this method converts it to  mask
238              using the specified colour as the mask colour.
239
240              If  the  image has an alpha channel, all pixels with alpha value
241              less than threshold are replaced with the mask  colour  and  the
242              alpha channel is removed. Otherwise nothing is done.
243
244              Since: 2.9.0
245
246              Return: Returns true on success, false on error.
247
248       convertToGreyscale(This) -> wxImage()
249
250              Types:
251
252                 This = wxImage()
253
254              Returns a greyscale version of the image.
255
256              Since: 2.9.0
257
258       convertToGreyscale(This, Weight_r, Weight_g, Weight_b) ->
259                             wxImage()
260
261              Types:
262
263                 This = wxImage()
264                 Weight_r = Weight_g = Weight_b = number()
265
266              Returns a greyscale version of the image.
267
268              The  returned image uses the luminance component of the original
269              to calculate the greyscale. Defaults to using the standard ITU-T
270              BT.601  when  converting  to  YUV, where every pixel equals (R *
271              weight_r) + (G * weight_g) + (B * weight_b).
272
273       convertToMono(This, R, G, B) -> wxImage()
274
275              Types:
276
277                 This = wxImage()
278                 R = G = B = integer()
279
280              Returns monochromatic version of the image.
281
282              The returned image has  white  colour  where  the  original  has
283              (r,g,b) colour and black colour everywhere else.
284
285       copy(This) -> wxImage()
286
287              Types:
288
289                 This = wxImage()
290
291              Returns an identical copy of this image.
292
293       create(This, Sz) -> boolean()
294
295              Types:
296
297                 This = wxImage()
298                 Sz = {W :: integer(), H :: integer()}
299
300       create(This, Width, Height) -> boolean()
301
302       create(This, Sz, Data) -> boolean()
303
304       create(This, Sz, Height :: [Option]) -> boolean()
305
306              Types:
307
308                 This = wxImage()
309                 Sz = {W :: integer(), H :: integer()}
310                 Option = {clear, boolean()}
311
312              This is an overloaded member function, provided for convenience.
313              It differs from the above function only in what  argument(s)  it
314              accepts.
315
316       create(This, Width, Height, Data) -> boolean()
317
318       create(This, Width, Height, Data :: [Option]) -> boolean()
319
320       create(This, Sz, Data, Alpha) -> boolean()
321
322              Types:
323
324                 This = wxImage()
325                 Sz = {W :: integer(), H :: integer()}
326                 Data = Alpha = binary()
327
328              This is an overloaded member function, provided for convenience.
329              It differs from the above function only in what  argument(s)  it
330              accepts.
331
332       create(This, Width, Height, Data, Alpha) -> boolean()
333
334              Types:
335
336                 This = wxImage()
337                 Width = Height = integer()
338                 Data = Alpha = binary()
339
340              Creates a fresh image.
341
342              See new/4 for more info.
343
344              Return: true if the call succeeded, false otherwise.
345
346       'Destroy'(This) -> ok
347
348              Types:
349
350                 This = wxImage()
351
352              Destroys the image data.
353
354       findFirstUnusedColour(This) -> Result
355
356              Types:
357
358                 Result =
359                     {Res :: boolean(),
360                      R :: integer(),
361                      G :: integer(),
362                      B :: integer()}
363                 This = wxImage()
364
365       findFirstUnusedColour(This, Options :: [Option]) -> Result
366
367              Types:
368
369                 Result =
370                     {Res :: boolean(),
371                      R :: integer(),
372                      G :: integer(),
373                      B :: integer()}
374                 This = wxImage()
375                 Option =
376                     {startR, integer()} |
377                     {startG, integer()} |
378                     {startB, integer()}
379
380              Finds the first colour that is never used in the image.
381
382              The  search  begins at given initial colour and continues by in‐
383              creasing R, G and B components (in this order) by 1 until an un‐
384              used colour is found or the colour space exhausted.
385
386              The  parameters  r,  g,  b are pointers to variables to save the
387              colour.
388
389              The parameters startR, startG, startB define the initial  values
390              of the colour. The returned colour will have RGB values equal to
391              or greater than these.
392
393              Return: Returns false if there is no unused colour left, true on
394              success.
395
396              Note:  This  method involves computing the histogram, which is a
397              computationally intensive operation.
398
399       getImageExtWildcard() -> unicode:charlist()
400
401              Iterates all registered wxImageHandler (not implemented  in  wx)
402              objects,  and  returns  a string containing file extension masks
403              suitable for passing to file open/save dialog boxes.
404
405              Return:   The    format    of    the    returned    string    is
406              "(*.ext1;*.ext2)|*.ext1;*.ext2".  It  is  usually a good idea to
407              prepend a description before passing the result to  the  dialog.
408              Example:
409
410              See: wxImageHandler (not implemented in wx)
411
412       getAlpha(This) -> binary()
413
414              Types:
415
416                 This = wxImage()
417
418              Returns  pointer  to the array storing the alpha values for this
419              image.
420
421              This pointer is NULL for the images without the  alpha  channel.
422              If  the image does have it, this pointer may be used to directly
423              manipulate the alpha values which are stored as the RGB ones.
424
425       getAlpha(This, X, Y) -> integer()
426
427              Types:
428
429                 This = wxImage()
430                 X = Y = integer()
431
432              Return alpha value at given pixel location.
433
434       getBlue(This, X, Y) -> integer()
435
436              Types:
437
438                 This = wxImage()
439                 X = Y = integer()
440
441              Returns the blue intensity at the given coordinate.
442
443       getData(This) -> binary()
444
445              Types:
446
447                 This = wxImage()
448
449              Returns the image data as an array.
450
451              This is most often used when doing  direct  image  manipulation.
452              The  return  value  points  to  an array of characters in RGBRG‐
453              BRGB... format in the top-to-bottom, left-to-right  order,  that
454              is  the  first RGB triplet corresponds to the first pixel of the
455              first row, the second one - to the second pixel of the first row
456              and  so  on until the end of the first row, with second row fol‐
457              lowing after it and so on.
458
459              You should not delete the returned pointer nor pass it  to  set‐
460              Data/4.
461
462       getGreen(This, X, Y) -> integer()
463
464              Types:
465
466                 This = wxImage()
467                 X = Y = integer()
468
469              Returns the green intensity at the given coordinate.
470
471       getImageCount(Filename) -> integer()
472
473              Types:
474
475                 Filename = unicode:chardata()
476
477       getImageCount(Filename, Options :: [Option]) -> integer()
478
479              Types:
480
481                 Filename = unicode:chardata()
482                 Option = {type, wx:wx_enum()}
483
484              If  the  image  file  contains more than one image and the image
485              handler is capable of retrieving these individually, this  func‐
486              tion will return the number of available images.
487
488              For  the overload taking the parameter filename, that's the name
489              of the file to query. For  the  overload  taking  the  parameter
490              stream, that's the opened input stream with image data.
491
492              See  wxImageHandler::GetImageCount() (not implemented in wx) for
493              more info.
494
495              The parameter type may be one of the following values:
496
497              Return: Number of available images.  For  most  image  handlers,
498              this  is  1 (exceptions are TIFF and ICO formats as well as ani‐
499              mated GIFs for which this function returns the number of  frames
500              in the animation).
501
502       getHeight(This) -> integer()
503
504              Types:
505
506                 This = wxImage()
507
508              Gets the height of the image in pixels.
509
510              See: getWidth/1, GetSize() (not implemented in wx)
511
512       getMaskBlue(This) -> integer()
513
514              Types:
515
516                 This = wxImage()
517
518              Gets the blue value of the mask colour.
519
520       getMaskGreen(This) -> integer()
521
522              Types:
523
524                 This = wxImage()
525
526              Gets the green value of the mask colour.
527
528       getMaskRed(This) -> integer()
529
530              Types:
531
532                 This = wxImage()
533
534              Gets the red value of the mask colour.
535
536       getOrFindMaskColour(This) -> Result
537
538              Types:
539
540                 Result =
541                     {Res :: boolean(),
542                      R :: integer(),
543                      G :: integer(),
544                      B :: integer()}
545                 This = wxImage()
546
547              Get  the  current  mask  colour or find a suitable unused colour
548              that could be used as a mask colour.
549
550              Returns true if the image currently has a mask.
551
552       getPalette(This) -> wxPalette:wxPalette()
553
554              Types:
555
556                 This = wxImage()
557
558              Returns the palette associated with the image.
559
560              Currently the palette is only used when converting  to  wxBitmap
561              under Windows.
562
563              Some  of the wxImage handlers have been modified to set the pal‐
564              ette if one exists in the image file (usually 256 or less colour
565              images in GIF or PNG format).
566
567       getRed(This, X, Y) -> integer()
568
569              Types:
570
571                 This = wxImage()
572                 X = Y = integer()
573
574              Returns the red intensity at the given coordinate.
575
576       getSubImage(This, Rect) -> wxImage()
577
578              Types:
579
580                 This = wxImage()
581                 Rect =
582                     {X :: integer(),
583                      Y :: integer(),
584                      W :: integer(),
585                      H :: integer()}
586
587              Returns  a  sub image of the current one as long as the rect be‐
588              longs entirely to the image.
589
590       getWidth(This) -> integer()
591
592              Types:
593
594                 This = wxImage()
595
596              Gets the width of the image in pixels.
597
598              See: getHeight/1, GetSize() (not implemented in wx)
599
600       hasAlpha(This) -> boolean()
601
602              Types:
603
604                 This = wxImage()
605
606              Returns true if this image has alpha channel, false otherwise.
607
608              See: getAlpha/3, setAlpha/4
609
610       hasMask(This) -> boolean()
611
612              Types:
613
614                 This = wxImage()
615
616              Returns true if there is a mask active, false otherwise.
617
618       getOption(This, Name) -> unicode:charlist()
619
620              Types:
621
622                 This = wxImage()
623                 Name = unicode:chardata()
624
625              Gets a user-defined string-valued option.
626
627              Generic options:
628
629              Options specific to wxGIFHandler (not implemented in wx):
630
631              Return: The value of the option or an empty string if not found.
632              Use hasOption/2 if an empty string can be a valid option value.
633
634              See: setOption/3, getOptionInt/2, hasOption/2
635
636       getOptionInt(This, Name) -> integer()
637
638              Types:
639
640                 This = wxImage()
641                 Name = unicode:chardata()
642
643              Gets a user-defined integer-valued option.
644
645              The function is case-insensitive to name. If the given option is
646              not present, the function returns 0. Use hasOption/2 if 0  is  a
647              possibly valid value for the option.
648
649              Generic options:
650
651              Since: 2.9.3
652
653              Options specific to wxPNGHandler (not implemented in wx):
654
655              Options specific to wxTIFFHandler (not implemented in wx):
656
657              Options specific to wxGIFHandler (not implemented in wx):
658
659              Note:   Be   careful  when  combining  the  options  wxIMAGE_OP‐
660              TION_TIFF_SAMPLESPERPIXEL,    wxIMAGE_OPTION_TIFF_BITSPERSAMPLE,
661              and  wxIMAGE_OPTION_TIFF_PHOTOMETRIC.  While  some  measures are
662              taken to prevent illegal combinations and/or values, it is still
663              easy  to abuse them and come up with invalid results in the form
664              of either corrupted images or crashes.
665
666              Return: The value of the option or 0 if not  found.  Use  hasOp‐
667              tion/2 if 0 can be a valid option value.
668
669              See: setOption/3, getOption/2
670
671       hasOption(This, Name) -> boolean()
672
673              Types:
674
675                 This = wxImage()
676                 Name = unicode:chardata()
677
678              Returns true if the given option is present.
679
680              The function is case-insensitive to name.
681
682              The  lists of the currently supported options are in getOption/2
683              and getOptionInt/2 function docs.
684
685              See: setOption/3, getOption/2, getOptionInt/2
686
687       initAlpha(This) -> ok
688
689              Types:
690
691                 This = wxImage()
692
693              Initializes the image alpha channel data.
694
695              It is an error to call it if the image already has  alpha  data.
696              If  it doesn't, alpha data will be by default initialized to all
697              pixels being fully opaque. But if the image has a  mask  colour,
698              all mask pixels will be completely transparent.
699
700       initStandardHandlers() -> ok
701
702              Internal use only.
703
704              Adds  standard  image format handlers. It only install wxBMPHan‐
705              dler for the time being, which is used by wxBitmap.
706
707              This function is called by wxWidgets on startup,  and  shouldn't
708              be called by the user.
709
710              See: wxImageHandler (not implemented in wx), ?wxInitAllImageHan‐
711              dlers(), wxQuantize (not implemented in wx)
712
713       isTransparent(This, X, Y) -> boolean()
714
715              Types:
716
717                 This = wxImage()
718                 X = Y = integer()
719
720       isTransparent(This, X, Y, Options :: [Option]) -> boolean()
721
722              Types:
723
724                 This = wxImage()
725                 X = Y = integer()
726                 Option = {threshold, integer()}
727
728              Returns true if the given pixel is transparent, i.e. either  has
729              the  mask  colour  if this image has a mask or if this image has
730              alpha channel and alpha value of this  pixel  is  strictly  less
731              than threshold.
732
733       loadFile(This, Name) -> boolean()
734
735              Types:
736
737                 This = wxImage()
738                 Name = unicode:chardata()
739
740       loadFile(This, Name, Options :: [Option]) -> boolean()
741
742              Types:
743
744                 This = wxImage()
745                 Name = unicode:chardata()
746                 Option = {type, wx:wx_enum()} | {index, integer()}
747
748              Loads an image from a file.
749
750              If  no handler type is provided, the library will try to autode‐
751              tect the format.
752
753       loadFile(This, Name, Mimetype, Options :: [Option]) -> boolean()
754
755              Types:
756
757                 This = wxImage()
758                 Name = Mimetype = unicode:chardata()
759                 Option = {index, integer()}
760
761              Loads an image from a file.
762
763              If no handler type is provided, the library will try to  autode‐
764              tect the format.
765
766       ok(This) -> boolean()
767
768              Types:
769
770                 This = wxImage()
771
772              See: isOk/1.
773
774       isOk(This) -> boolean()
775
776              Types:
777
778                 This = wxImage()
779
780              Returns true if image data is present.
781
782       removeHandler(Name) -> boolean()
783
784              Types:
785
786                 Name = unicode:chardata()
787
788              Finds the handler with the given name, and removes it.
789
790              The handler is also deleted.
791
792              Return:  true if the handler was found and removed, false other‐
793              wise.
794
795              See: wxImageHandler (not implemented in wx)
796
797       mirror(This) -> wxImage()
798
799              Types:
800
801                 This = wxImage()
802
803       mirror(This, Options :: [Option]) -> wxImage()
804
805              Types:
806
807                 This = wxImage()
808                 Option = {horizontally, boolean()}
809
810              Returns a mirrored copy of the image.
811
812              The parameter horizontally indicates the orientation.
813
814       replace(This, R1, G1, B1, R2, G2, B2) -> ok
815
816              Types:
817
818                 This = wxImage()
819                 R1 = G1 = B1 = R2 = G2 = B2 = integer()
820
821              Replaces  the  colour  specified  by  r1,g1,b1  by  the   colour
822              r2,g2,b2.
823
824       rescale(This, Width, Height) -> wxImage()
825
826              Types:
827
828                 This = wxImage()
829                 Width = Height = integer()
830
831       rescale(This, Width, Height, Options :: [Option]) -> wxImage()
832
833              Types:
834
835                 This = wxImage()
836                 Width = Height = integer()
837                 Option = {quality, wx:wx_enum()}
838
839              Changes  the  size  of the image in-place by scaling it: after a
840              call to this function,the image will have the  given  width  and
841              height.
842
843              For  a  description  of  the  quality parameter, see the scale/4
844              function. Returns the (modified) image itself.
845
846              See: scale/4
847
848       resize(This, Size, Pos) -> wxImage()
849
850              Types:
851
852                 This = wxImage()
853                 Size = {W :: integer(), H :: integer()}
854                 Pos = {X :: integer(), Y :: integer()}
855
856       resize(This, Size, Pos, Options :: [Option]) -> wxImage()
857
858              Types:
859
860                 This = wxImage()
861                 Size = {W :: integer(), H :: integer()}
862                 Pos = {X :: integer(), Y :: integer()}
863                 Option = {r, integer()} | {g, integer()} | {b, integer()}
864
865              Changes the size of the image in-place  without  scaling  it  by
866              adding either a border with the given colour or cropping as nec‐
867              essary.
868
869              The image is pasted into a new image with  the  given  size  and
870              background colour at the position pos relative to the upper left
871              of the new image.
872
873              If red = green = blue = -1 then  use  either  the  current  mask
874              colour  if  set or find, use, and set a suitable mask colour for
875              any newly exposed areas.
876
877              Return: The (modified) image itself.
878
879              See: size/4
880
881       rotate(This, Angle, RotationCentre) -> wxImage()
882
883              Types:
884
885                 This = wxImage()
886                 Angle = number()
887                 RotationCentre = {X :: integer(), Y :: integer()}
888
889       rotate(This, Angle, RotationCentre, Options :: [Option]) ->
890                 wxImage()
891
892              Types:
893
894                 This = wxImage()
895                 Angle = number()
896                 RotationCentre = {X :: integer(), Y :: integer()}
897                 Option =
898                     {interpolating, boolean()} |
899                     {offset_after_rotation, {X :: integer(), Y :: integer()}}
900
901              Rotates the image about the given point, by angle radians.
902
903              Passing true to interpolating results in better  image  quality,
904              but is slower.
905
906              If  the  image  has a mask, then the mask colour is used for the
907              uncovered pixels in the rotated image  background.  Else,  black
908              (rgb 0, 0, 0) will be used.
909
910              Returns the rotated image, leaving this image intact.
911
912       rotateHue(This, Angle) -> ok
913
914              Types:
915
916                 This = wxImage()
917                 Angle = number()
918
919              Rotates  the hue of each pixel in the image by angle, which is a
920              double in the range of -1.0 to +1.0, where -1.0  corresponds  to
921              -360 degrees and +1.0 corresponds to +360 degrees.
922
923       rotate90(This) -> wxImage()
924
925              Types:
926
927                 This = wxImage()
928
929       rotate90(This, Options :: [Option]) -> wxImage()
930
931              Types:
932
933                 This = wxImage()
934                 Option = {clockwise, boolean()}
935
936              Returns  a copy of the image rotated 90 degrees in the direction
937              indicated by clockwise.
938
939       saveFile(This, Name) -> boolean()
940
941              Types:
942
943                 This = wxImage()
944                 Name = unicode:chardata()
945
946              Saves an image in the named file.
947
948              File type is determined from the extension  of  the  file  name.
949              Note  that this function may fail if the extension is not recog‐
950              nized! You can use one of the forms  above  to  save  images  to
951              files with non-standard extensions.
952
953       saveFile(This, Name, Type) -> boolean()
954
955       saveFile(This, Name, Mimetype) -> boolean()
956
957              Types:
958
959                 This = wxImage()
960                 Name = Mimetype = unicode:chardata()
961
962              Saves an image in the named file.
963
964       scale(This, Width, Height) -> wxImage()
965
966              Types:
967
968                 This = wxImage()
969                 Width = Height = integer()
970
971       scale(This, Width, Height, Options :: [Option]) -> wxImage()
972
973              Types:
974
975                 This = wxImage()
976                 Width = Height = integer()
977                 Option = {quality, wx:wx_enum()}
978
979              Returns a scaled version of the image.
980
981              This  is  also useful for scaling bitmaps in general as the only
982              other way to scale bitmaps is to blit a wxMemoryDC into  another
983              wxMemoryDC.
984
985              The  parameter  quality determines what method to use for resam‐
986              pling the image, see wxImageResizeQuality documentation.
987
988              It should be noted that although using wxIMAGE_QUALITY_HIGH pro‐
989              duces much nicer looking results it is a slower method. Downsam‐
990              pling will use the box averaging method which seems  to  operate
991              very fast. If you are upsampling larger images using this method
992              you will most likely notice that it is a bit slower and  in  ex‐
993              treme cases it will be quite substantially slower as the bicubic
994              algorithm has to process a lot of data.
995
996              It should also be noted that the high quality  scaling  may  not
997              work  as  expected when using a single mask colour for transpar‐
998              ency, as the scaling will blur the image and will therefore  re‐
999              move the mask partially. Using the alpha channel will work.
1000
1001              Example:
1002
1003              See: rescale/4
1004
1005       size(This, Size, Pos) -> wxImage()
1006
1007              Types:
1008
1009                 This = wxImage()
1010                 Size = {W :: integer(), H :: integer()}
1011                 Pos = {X :: integer(), Y :: integer()}
1012
1013       size(This, Size, Pos, Options :: [Option]) -> wxImage()
1014
1015              Types:
1016
1017                 This = wxImage()
1018                 Size = {W :: integer(), H :: integer()}
1019                 Pos = {X :: integer(), Y :: integer()}
1020                 Option = {r, integer()} | {g, integer()} | {b, integer()}
1021
1022              Returns  a  resized  version of this image without scaling it by
1023              adding either a border with the given colour or cropping as nec‐
1024              essary.
1025
1026              The  image  is  pasted  into a new image with the given size and
1027              background colour at the position pos relative to the upper left
1028              of the new image.
1029
1030              If  red  =  green = blue = -1 then the areas of the larger image
1031              not covered by this image are made transparent by  filling  them
1032              with  the  image  mask colour (which will be allocated automati‐
1033              cally if it isn't currently set).
1034
1035              Otherwise, the areas will be filled with  the  colour  with  the
1036              specified RGB components.
1037
1038              See: resize/4
1039
1040       setAlpha(This, Alpha) -> ok
1041
1042              Types:
1043
1044                 This = wxImage()
1045                 Alpha = binary()
1046
1047              This  function  is similar to setData/4 and has similar restric‐
1048              tions.
1049
1050              The pointer passed to it may however be NULL in which  case  the
1051              function will allocate the alpha array internally - this is use‐
1052              ful to add alpha channel data to an  image  which  doesn't  have
1053              any.
1054
1055              If the pointer is not NULL, it must have one byte for each image
1056              pixel and be allocated with malloc(). wxImage takes ownership of
1057              the pointer and will free it unless static_data parameter is set
1058              to true - in this case the caller should do it.
1059
1060       setAlpha(This, X, Y, Alpha) -> ok
1061
1062              Types:
1063
1064                 This = wxImage()
1065                 X = Y = Alpha = integer()
1066
1067              Sets the alpha value for the given pixel.
1068
1069              This function should only be called if the image has alpha chan‐
1070              nel data, use hasAlpha/1 to check for this.
1071
1072       setData(This, Data) -> ok
1073
1074              Types:
1075
1076                 This = wxImage()
1077                 Data = binary()
1078
1079              Sets the image data without performing checks.
1080
1081              The  data  given  must have the size (width*height*3) or results
1082              will be unexpected. Don't use this method if you aren't sure you
1083              know what you are doing.
1084
1085              The data must have been allocated with malloc(), NOT with opera‐
1086              tor new.
1087
1088              If static_data is false, after this call the pointer to the data
1089              is  owned  by  the  wxImage object, that will be responsible for
1090              deleting it. Do not pass to this  function  a  pointer  obtained
1091              through getData/1.
1092
1093       setData(This, Data, New_width, New_height) -> ok
1094
1095              Types:
1096
1097                 This = wxImage()
1098                 Data = binary()
1099                 New_width = New_height = integer()
1100
1101              This is an overloaded member function, provided for convenience.
1102              It differs from the above function only in what  argument(s)  it
1103              accepts.
1104
1105       setMask(This) -> ok
1106
1107              Types:
1108
1109                 This = wxImage()
1110
1111       setMask(This, Options :: [Option]) -> ok
1112
1113              Types:
1114
1115                 This = wxImage()
1116                 Option = {mask, boolean()}
1117
1118              Specifies whether there is a mask or not.
1119
1120              The area of the mask is determined by the current mask colour.
1121
1122       setMaskColour(This, Red, Green, Blue) -> ok
1123
1124              Types:
1125
1126                 This = wxImage()
1127                 Red = Green = Blue = integer()
1128
1129              Sets  the mask colour for this image (and tells the image to use
1130              the mask).
1131
1132       setMaskFromImage(This, Mask, Mr, Mg, Mb) -> boolean()
1133
1134              Types:
1135
1136                 This = Mask = wxImage()
1137                 Mr = Mg = Mb = integer()
1138
1139              Sets image's mask so that the pixels  that  have  RGB  value  of
1140              mr,mg,mb in mask will be masked in the image.
1141
1142              This  is  done  by  first finding an unused colour in the image,
1143              setting this colour as the  mask  colour  and  then  using  this
1144              colour  to  draw all pixels in the image who corresponding pixel
1145              in mask has given RGB value.
1146
1147              The parameter mask is the mask image to extract mask shape from.
1148              It must have the same dimensions as the image.
1149
1150              The  parameters  mr,  mg, mb are the RGB values of the pixels in
1151              mask that will be used to create the mask.
1152
1153              Return: Returns false if mask does not have same  dimensions  as
1154              the  image or if there is no unused colour left. Returns true if
1155              the mask was successfully applied.
1156
1157              Note: Note that this method involves  computing  the  histogram,
1158              which is a computationally intensive operation.
1159
1160       setOption(This, Name, Value) -> ok
1161
1162       setOption(This, Name, Value) -> ok
1163
1164              Types:
1165
1166                 This = wxImage()
1167                 Name = Value = unicode:chardata()
1168
1169              Sets a user-defined option.
1170
1171              The function is case-insensitive to name.
1172
1173              For  example,  when saving as a JPEG file, the option quality is
1174              used, which is a number between 0 and 100 (0 is terrible, 100 is
1175              very good).
1176
1177              The  lists of the currently supported options are in getOption/2
1178              and getOptionInt/2 function docs.
1179
1180              See: getOption/2, getOptionInt/2, hasOption/2
1181
1182       setPalette(This, Palette) -> ok
1183
1184              Types:
1185
1186                 This = wxImage()
1187                 Palette = wxPalette:wxPalette()
1188
1189              Associates a palette with the image.
1190
1191              The palette may be used when converting wxImage to wxBitmap (MSW
1192              only at present) or in file save operations (none as yet).
1193
1194       setRGB(This, Rect, Red, Green, Blue) -> ok
1195
1196              Types:
1197
1198                 This = wxImage()
1199                 Rect =
1200                     {X :: integer(),
1201                      Y :: integer(),
1202                      W :: integer(),
1203                      H :: integer()}
1204                 Red = Green = Blue = integer()
1205
1206              Sets the colour of the pixels within the given rectangle.
1207
1208              This routine performs bounds-checks for the coordinate so it can
1209              be considered a safe way to manipulate the data.
1210
1211       setRGB(This, X, Y, R, G, B) -> ok
1212
1213              Types:
1214
1215                 This = wxImage()
1216                 X = Y = R = G = B = integer()
1217
1218              Set the color of the pixel at the given x and y coordinate.
1219
1220
1221
1222wxWidgets team.                    wx 2.2.2                         wxImage(3)
Impressum