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