Set the image data. Parameters ---------- image : array-like The image data. texture_format : str or None
(self, image, copy=False)
| 373 | return tex |
| 374 | |
| 375 | def set_data(self, image, copy=False): |
| 376 | """Set the image data. |
| 377 | |
| 378 | Parameters |
| 379 | ---------- |
| 380 | image : array-like |
| 381 | The image data. |
| 382 | texture_format : str or None |
| 383 | |
| 384 | """ |
| 385 | data = np.array(image, copy=copy or np_copy_if_needed) |
| 386 | if np.iscomplexobj(data): |
| 387 | raise TypeError( |
| 388 | "Complex data types not supported. Please use 'ComplexImage' instead" |
| 389 | ) |
| 390 | # can the texture handle this data? |
| 391 | self._texture.check_data_format(data) |
| 392 | if self._data is None or self._data.shape[:2] != data.shape[:2]: |
| 393 | # Only rebuild if the size of the image changed |
| 394 | self._need_vertex_update = True |
| 395 | self._data = data |
| 396 | self._need_texture_upload = True |
| 397 | |
| 398 | self.update() |
| 399 | |
| 400 | def view(self): |
| 401 | """Get the :class:`vispy.visuals.visual.VisualView` for this visual.""" |
no test coverage detected