Files
amazing/mlx/docs/mlx_pixel_put.3
T
2026-03-25 17:40:13 +01:00

84 lines
1.9 KiB
Plaintext

.TH MiniLibX 3 "September 19, 2002"
.SH NAME
MiniLibX - Drawing inside windows
.SH SYNOPSYS
.nf
.I int
.fi
.B mlx_pixel_put
(
.I void *mlx_ptr, void *win_ptr, unsigned int x, unsigned int y, unsigned int color
);
.nf
.I int
.fi
.B mlx_string_put
(
.I void *mlx_ptr, void *win_ptr, unsigned int x, unsigned int y, unsigned int color, char *string
);
.SH DESCRIPTION
The
.B mlx_pixel_put
() function draws a defined pixel in the window
.I win_ptr
using the (
.I x
,
.I y
) coordinates, and the specified
.I color
\&. The origin (0,0) is the upper left corner of the window, the x and y axis
respectively pointing right and down. The connection
identifier,
.I mlx_ptr
, is needed (see the
.B mlx
man page).
Parameters for
.B mlx_string_put
() have the same meaning. Instead of a simple pixel, the specified
.I string
will be displayed at (
.I x
,
.I y
).
Both functions will discard any display outside the window. This makes
.B mlx_pixel_put
slow. Consider using images instead.
.SH COLOUR MANAGEMENT
The
.I color
parameter has an unsigned integer type. The displayed colour needs to be encoded
in this integer, following a defined scheme. All displayable colours
can be split in 3 basic colours: red, green and blue. Three associated
values, in the 0-255 range, represent how much of each colour is mixed up
to create the original colour. The fourth byte represent transparency,
where 0 is fully transparent and 255 opaque. Theses four values must be set inside the
unsigned integer to display the right colour. The bytes of
this integer are filled as shown in the picture below:
.nf
| B | G | R | A | colour integer
+---+---+---+---+
.fi
While filling the integer, make sure you avoid endian problems. Example:
the "blue" byte will be the least significant byte inside the integer on a
little endian machine.
.SH SEE ALSO
mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3), mlx_extra(3)
.SH AUTHOR
Copyright ol@ - 2002-2025 - Olivier Crouzet