/ fdf / fdf / mlx / man / man3 / mlx_pixel_put.3
mlx_pixel_put.3
 1  .TH MiniLibX 3 "September 19, 2002"
 2  .SH NAME
 3  MiniLibX - Drawing inside windows
 4  .SH SYNOPSYS
 5  
 6  .nf
 7  .I int
 8  .fi
 9  .B mlx_pixel_put
10  (
11  .I void *mlx_ptr, void *win_ptr, int x, int y, int color
12  );
13  
14  .nf
15  .I int
16  .fi
17  .B mlx_string_put
18  (
19  .I void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string
20  );
21  
22  
23  .SH DESCRIPTION
24  The
25  .B mlx_pixel_put
26  () function draws a defined pixel in the window
27  .I win_ptr
28  using the (
29  .I x
30  ,
31  .I y
32  ) coordinates, and the specified
33  .I color
34  \&. The origin (0,0) is the upper left corner of the window, the x and y axis
35  respectively pointing right and down. The connection
36  identifier,
37  .I mlx_ptr
38  , is needed (see the
39  .B mlx
40  man page).
41  
42  Parameters for
43  .B mlx_string_put
44  () have the same meaning. Instead of a simple pixel, the specified
45  .I string
46  will be displayed at (
47  .I x
48  ,
49  .I y
50  ).
51  
52  Both functions will discard any display outside the window. This makes
53  .B mlx_pixel_put
54  slow. Consider using images instead.
55  
56  .SH COLOR MANAGEMENT
57  The
58  .I color
59  parameter has an integer type. The displayed color needs to be encoded
60  in this integer, following a defined scheme. All displayable colors
61  can be split in 3 basic colors: red, green and blue. Three associated
62  values, in the 0-255 range, represent how much of each color is mixed up
63  to create the original color. Theses three values must be set inside the
64  integer to display the right color. The three least significant bytes of
65  this integer are filled as shown in the picture below:
66  
67  .nf
68          | 0 | R | G | B |   color integer
69          +---+---+---+---+
70  .fi
71  
72  
73  While filling the integer, make sure you avoid endian problems. Remember
74  that the "blue" byte should always be the least significant one.
75  
76  Depending on hardware capabilities, the most significant bit can handle
77  transparency. Beware, at the opposite of the OpenGL classics, it does
78  not represent opacity.
79  
80  .SH SEE ALSO
81  mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3)
82  
83  
84  .SH AUTHOR
85  Copyright ol@ - 2002-2019 - Olivier Crouzet