|
|
|
|||||||||||
Como dibujar un imagen (jpg, png, gif, etc..) en CairoJuly
21
Para dibujar usando cairo por lo general creas un objeto heredando propiedades de gtk.DrawingArea. y obviamente, tenemos un metodo para el redibujado. Dentro de ese metodo metemos esto:
def setPixbuf(self,pixbuf): if type(pixbuf) != gtk.gdk.Pixbuf: raise TypeError("Pixbuf debe ser %s recibido %s"%(gtk.gdk.Pixbuf, type(pixbuf))) self.__Pixbuf = pixbuf self.emit("expose-event",gtk.gdk.Event(gtk.gdk.EXPOSE)) def exposeEvent(self, widget,event): x,y,w,h = self.allocation try: context = self.window.cairo_create() except AttributeError: return True if self.__Pixbuf != None: scaledPixbuf = self.__Pixbuf.scale_simple(ancho, alto, gtk.gdk.INTERP_BILINEAR) ct = gtk.gdk.CairoContext(context) ct.set_source_pixbuf(scaledPixbuf,BORDER_WIDTH,BORDER_WIDTH) context.paint() context.stroke()
Comment XML feeds: RSS | Atom
|
|
Recent Comments On BlogMarco Antonio Islas Cruz on Marco Antonio Islas Cruz on Marco Antonio Islas Cruz on Getting ready Marco Antonio Islas Cruz on Python: Create win32 services using Python and py2exe jopython@gmail.com on Python: Create win32 services using Python and py2exe yodenuevo on Holy Shit! markuz on Holy Shit! yo on Holy Shit! Gustavo on Things that happen last week Marco Antonio Islas Cruz on Christine: rola_christine.py |
|||||||||
|
|
|||||||||||
Leave a Comment