Image creation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Odalrick

    #1

    Image creation

    I need to generate wx.Bitmap with a hole in them, i.e. the whole bitmap
    is one colour, greyish with alpha = 255*.6, except for one rectangle
    that has alpha = 0 .

    Currently I'm doing this with PIL, thus:

    def _init_mask( self ):
    mask = Image.new( 'RGBA', self.size, color=options['mask_colour'] )
    draw = ImageDraw.Draw( mask )
    draw.rectangle( self.clip_area. box, fill=( 255, 255, 255, 0) )
    self._mask = pilToBitmap( mask, alpha=True )

    Obviously this is inefficient, but I couldn't find any way to give
    alpha values with wxPython's image objects and premature optimization
    etcetera... Well, now the program works, but is a bit sluggish so I'm
    asking if anyone can give me some pointers to speeding this up.

    /Odalrick

Working...