]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/ogl/_bmpshape.py
1 # -*- coding: iso-8859-1 -*-
2 #----------------------------------------------------------------------------
4 # Purpose: Bitmap shape
6 # Author: Pierre Hjälm (from C++ original by Julian Smart)
10 # Copyright: (c) 2004 Pierre Hjälm - 1998 Julian Smart
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
14 from _basic
import RectangleShape
17 class BitmapShape(RectangleShape
):
18 """Draws a bitmap (non-resizable)."""
20 RectangleShape
.__init
__(self
, 100, 50)
24 if not self
._bitmap
.Ok():
27 x
= self
._xpos
- self
._bitmap
.GetWidth() / 2.0
28 y
= self
._ypos
- self
._bitmap
.GetHeight() / 2.0
29 dc
.DrawBitmap(self
._bitmap
, x
, y
, True)
31 def SetSize(self
, w
, h
, recursive
= True):
33 w
= self
._bitmap
.GetWidth()
34 h
= self
._bitmap
.GetHeight()
36 self
.SetAttachmentSize(w
, h
)
41 self
.SetDefaultRegionSize()
44 """Return a the bitmap associated with this shape."""
47 def SetBitmap(self
, bitmap
):
48 """Set the bitmap associated with this shape.
50 You can delete the bitmap from the calling application, since
51 reference counting will take care of holding on to the internal bitmap
56 self
.SetSize(self
._bitmap
.GetWidth(), self
._bitmap
.GetHeight())
58 def SetFilename(self
, f
):
59 """Set the bitmap filename."""
62 def GetFilename(self
):
63 """Return the bitmap filename."""