]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxImage.py
Version number update
[wxWidgets.git] / wxPython / demo / wxImage.py
1 # 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 from Main import opj
9
10 #----------------------------------------------------------------------
11
12 def runTest(frame, nb, log):
13 bmp = wx.Image(opj('bitmaps/image.bmp'), wx.BITMAP_TYPE_BMP).ConvertToBitmap()
14 gif = wx.Image(opj('bitmaps/image.gif'), wx.BITMAP_TYPE_GIF).ConvertToBitmap()
15 png = wx.Image(opj('bitmaps/image.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
16 jpg = wx.Image(opj('bitmaps/image.jpg'), wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
17
18 panel = wx.Panel(nb, -1)
19
20 pos = 10
21 wx.StaticBitmap(panel, -1, bmp, (10, pos), (bmp.GetWidth(), bmp.GetHeight()))
22
23 pos = pos + bmp.GetHeight() + 10
24 wx.StaticBitmap(panel, -1, gif, (10, pos), (gif.GetWidth(), gif.GetHeight()))
25
26 pos = pos + gif.GetHeight() + 10
27 wx.StaticBitmap(panel, -1, png, (10, pos), (png.GetWidth(), png.GetHeight()))
28
29 pos = pos + png.GetHeight() + 10
30 wx.StaticBitmap(panel, -1, jpg, (10, pos), (jpg.GetWidth(), jpg.GetHeight()))
31
32 return panel
33
34 #----------------------------------------------------------------------
35
36
37
38 overview = """\
39 <html>
40 <body>
41 This class encapsulates a platform-independent image. An image can be created
42 from data, or using <code>wxBitmap.ConvertToImage</code>. An image can be loaded from
43 a file in a variety of formats, and is extensible to new formats via image
44 format handlers. Functions are available to set and get image bits, so it can
45 be used for basic image manipulation.
46
47 <p>The following image handlers are available. wxBMPHandler is always installed
48 by default. To use other image formats, install the appropriate handler or use
49 <code>wx.InitAllImageHandlers()</code>.
50
51 <p>
52 <table>
53 <tr><td width=25%>wxBMPHandler</td> <td>For loading and saving, always installed.</td></tr>
54 <tr><td>wxPNGHandler</td> <td>For loading and saving.</td> </tr>
55 <tr><td>wxJPEGHandler</td> <td>For loading and saving.</td> </tr>
56 <tr><td>wxGIFHandler</td> <td>Only for loading, due to legal issues.</td> </tr>
57 <tr><td>wxPCXHandler</td> <td>For loading and saving.</td> </tr>
58 <tr><td>wxPNMHandler</td> <td>For loading and saving.</td> </tr>
59 <tr><td>wxTIFFHandler</td> <td>For loading and saving.</td> </tr>
60 <tr><td>wxIFFHandler</td> <td>For loading only.</td> </tr>
61 <tr><td>wxXPMHandler</td> <td>For loading and saving.</td> </tr>
62 <tr><td>wxICOHandler</td> <td>For loading and saving.</td> </tr>
63 <tr><td>wxCURHandler</td> <td>For loading and saving.</td> </tr>
64 <tr><td>wxANIHandler</td> <td>For loading only.</td> </tr>
65 </table>
66
67 <p>When saving in PCX format, wxPCXHandler will count the number of different
68 colours in the image; if there are 256 or less colours, it will save as 8 bit,
69 else it will save as 24 bit.
70
71 <p>Loading PNMs only works for ASCII or raw RGB images. When saving in PNM format,
72 wxPNMHandler will always save as raw RGB.
73
74 </body>
75 </html>"""
76
77 if __name__ == '__main__':
78 import sys,os
79 import run
80 run.main(['', os.path.basename(sys.argv[0])])
81