def _get_texture(self): if self._texture is None: if self._data is None: return None self._texture = Texture.create_from_data(self._data) if not self.keep_data: self._data.release_data() return self._texture
def _get_texture(self): if self._texture is None: if self._data is None: return None self._texture = Texture.create_from_data( self._data, rectangle=self._texture_rectangle, mipmap=self._texture_mipmap) if not self.keep_data: self._data.release_data() return self._texture
def set_button_image(self): pos = self.to_window(*self.pos) size = self.size glReadBuffer(GL_FRONT) data = glReadPixels(pos[0], pos[1], size[0], size[1], GL_RGB, GL_UNSIGNED_BYTE) texture = Texture.create(size[0], size[1], format=GL_RGB) texture.blit_buffer(data, size) self._button_image = Image(texture) # Update all the buttons referencing this artifact try: blist = Storyapp().artifacts[self.Id][1] for im in blist: blist[im].image = self._button_image except KeyError: pass try: blist = Storyapp().backlog[self.Id][1] for im in blist: blist[im].image = self._button_image except KeyError: pass
def _get_texture(self): if self._texture is None: if self._data is None: return None self._texture = Texture.create_from_data(self._data) return self._texture