What pixel format do I use? I have a SVG file loaded, and rendering now. But, it is mixing up the RGBA channels. ( Meaning the lion is pink, instead of yellow. source file: http://croczilla.com/bits_and_pieces/svg/samples/lion/lion.svg
I use: init: self.screen = pygame.display.set_mode(( self.width, self.height )) # or: elf.screen = pygame.display.set_mode(( self.width, self.height ), 0, 32) And, to render the SVG: class Ship(object): """. """ def __init__(self, file=None): """create surface""" # Sprite.__init__(self) self.screen = pygame.display.get_surface() self.image = None self.filename = 'ship2.svg' self.width, self.height = WIDTH, HEIGHT def draw_svg(self): """ref: http://stackoverflow.com/questions/120584/svg-rendering-in-a-pygame-application """ print "Ship().draw_svg()" svg = rsvg.Handle(file= os.path.join('data', self.filename)) print "size = ", svg.get_dimension_data() dim = svg.get_dimension_data() self.width , self.height = dim[0], dim[1] data = array.array('c', chr(0) * self.width * self.height * 4 ) cairo_surf= cairo.ImageSurface.create_for_data( data, cairo.FORMAT_ARGB32, self.width, self.height, self.width * 4 ) ctx = cairo.Context(cairo_surf) # svg.render_cairo(ctx) self.image = pygame.image.frombuffer(data.tostring(), (self.width,self.height), "ARGB") def draw(self): """draw to screen""" if self.image is None: self.draw_svg() self.screen.blit(self.image, Rect(200,200,0,0)) -- Jake