MCPcopy
hub / github.com/XingangPan/DragGAN / update

Method update

gui_utils/gl_utils.py:180–191  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

178 gl.glBindTexture(gl.GL_TEXTURE_2D, prev_id)
179
180 def update(self, image):
181 if image is not None:
182 image = prepare_texture_data(image)
183 assert self.is_compatible(image=image)
184 with self.bind():
185 fmt = get_texture_format(self.dtype, self.channels)
186 gl.glPushClientAttrib(gl.GL_CLIENT_PIXEL_STORE_BIT)
187 gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, 1)
188 gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, fmt.internalformat, self.width, self.height, 0, fmt.format, fmt.type, image)
189 if self.mipmap:
190 gl.glGenerateMipmap(gl.GL_TEXTURE_2D)
191 gl.glPopClientAttrib()
192
193 def draw(self, *, pos=0, zoom=1, align=0, rint=False, color=1, alpha=1, rounding=0):
194 zoom = np.broadcast_to(np.asarray(zoom, dtype='float32'), [2])

Callers 8

__init__Method · 0.95
draw_frameMethod · 0.45
on_click_startFunction · 0.45
on_click_stopFunction · 0.45
on_click_remove_pointFunction · 0.45
on_click_enable_drawFunction · 0.45
on_click_remove_drawFunction · 0.45
on_click_add_pointFunction · 0.45

Calls 4

is_compatibleMethod · 0.95
bindMethod · 0.95
prepare_texture_dataFunction · 0.85
get_texture_formatFunction · 0.85

Tested by

no test coverage detected