DC#draw_bitmap with logical_function on Windows

Hi!
While testing the app I developed (on Linux), I encountered strange
behaviour on Windows for this method:

def draw(dc, x, y)
dc.pen = Wx::TRANSPARENT_PEN
dc.logical_function = Wx::COPY
if @bitmap
dc.draw_bitmap(@bitmap, x, y, false)
else
dc.brush = Wx::GREY_BRUSH
dc.draw_rectangle(x, y, TILE_WIDTH, TILE_WIDTH)
end
if @mask
dc.logical_function = Wx::AND
dc.draw_bitmap(@mask, x, y, false)
end
end

On Linux (Ubuntu 9.10, Ruby 1.8.7, wxRuby 2.0.1) @mask is drawn
correctly, while on Windows (XP SP 2, Ruby 1.8.6, with ‘backports’ gem)
it is drawn as if logical_function was Wx::COPY.

For now, I wrote a workaround which works for Windows:

module Wx
class DC
def draw_bitmap(bitmap, x, y, draw_transp)
m = MemoryDC.new
m.select_object(bitmap)
self.blit(x, y, bitmap.width, bitmap.height, m, 0, 0,
self.logical_function, draw_transp)
m.select_object(Wx::NULL_BITMAP)
end
end
end

It this a bug or a platform feature?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs