Is it possible to render textures in Image manually?

13 views
Skip to first unread message

xinming

unread,
Apr 23, 2017, 2:30:59 AM4/23/17
to kivy-...@googlegroups.com
I can deal with my textures in Widget, but I have to first use kivy.core.image to load the texture, is it possible directly use it in Image, here is my code, I want to blit the texture two times, is there any easy way to do the same effect in using Image?

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle
from kivy.core.image import Image as CoreImage
from kivy.core.window import Window


class MyWidget(Widget):
def __init__(self, **kw):
super(MyWidget, self).__init__(**kw)

with self.canvas:
texture = CoreImage('data/logo/kivy-icon-512.png').texture
texture.wrap = 'repeat'
Rectangle(texture=texture, size=self.size, pos=self.pos,tex_coords = (0, 0, -2, 0, -2, -1, 0, -1))


class MyApp(App):
def build(self):
return MyWidget(size=Window.size)


if __name__ == '__main__':
MyApp().run()


 

Reply all
Reply to author
Forward
0 new messages