pixel_put¶
MiniLibX: mlx_pixel_put
Sets one pixel of a window to a color.
Parameters¶
| Name | Type | Description |
|---|---|---|
mlx |
Mlx |
The connection from init |
win |
Window |
The window to draw in |
x |
int |
Column, from 0 (left edge) to width − 1 |
y |
int |
Row, from 0 (top edge) to height − 1 |
color |
int |
0xRRGGBB, for example 0xFF0000 for red |
Returns¶
None.
Raises¶
| Exception | When |
|---|---|
RuntimeError |
The window was closed: window is closed |
Notes¶
(0, 0)is the top-left corner, andygrows downwards.- Pixels outside the window are silently ignored, so shapes can go off the edge.
- Only the lowest 24 bits of
colorare used. Alpha doesn't apply topixel_put. - The pixel shows up on screen at the next frame of
loop. - Each call goes through Python, so drawing whole screens this way is slow
(about 300,000 calls for 640×480). For large areas, fill an
image and draw it with
put_image_to_window.