(image, *, pos=0, zoom=1, align=0, rint=True)
| 90 | #---------------------------------------------------------------------------- |
| 91 | |
| 92 | def draw_pixels(image, *, pos=0, zoom=1, align=0, rint=True): |
| 93 | pos = np.broadcast_to(np.asarray(pos, dtype='float32'), [2]) |
| 94 | zoom = np.broadcast_to(np.asarray(zoom, dtype='float32'), [2]) |
| 95 | align = np.broadcast_to(np.asarray(align, dtype='float32'), [2]) |
| 96 | image = prepare_texture_data(image) |
| 97 | height, width, channels = image.shape |
| 98 | size = zoom * [width, height] |
| 99 | pos = pos - size * align |
| 100 | if rint: |
| 101 | pos = np.rint(pos) |
| 102 | fmt = get_texture_format(image.dtype, channels) |
| 103 | |
| 104 | gl.glPushAttrib(gl.GL_CURRENT_BIT | gl.GL_PIXEL_MODE_BIT) |
| 105 | gl.glPushClientAttrib(gl.GL_CLIENT_PIXEL_STORE_BIT) |
| 106 | gl.glRasterPos2f(pos[0], pos[1]) |
| 107 | gl.glPixelZoom(zoom[0], -zoom[1]) |
| 108 | gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, 1) |
| 109 | gl.glDrawPixels(width, height, fmt.format, fmt.type, image) |
| 110 | gl.glPopClientAttrib() |
| 111 | gl.glPopAttrib() |
| 112 | |
| 113 | #---------------------------------------------------------------------------- |
| 114 |
nothing calls this directly
no test coverage detected