MLX42 1.0
MLX42
Loading...
Searching...
No Matches
mlx_put_pixel.c File Reference
#include "MLX42/MLX42_Int.h"
Include dependency graph for mlx_put_pixel.c:

Go to the source code of this file.

Functions

void mlx_draw_pixel (uint8_t *pixel, uint32_t color)
 
void mlx_put_pixel (mlx_image_t *image, uint32_t x, uint32_t y, uint32_t color)
 

Function Documentation

◆ mlx_draw_pixel()

void mlx_draw_pixel ( uint8_t pixel,
uint32_t  color 
)

Definition at line 16 of file mlx_put_pixel.c.

17{
18 *(pixel++) = (uint8_t)(color >> 24);
19 *(pixel++) = (uint8_t)(color >> 16);
20 *(pixel++) = (uint8_t)(color >> 8);
21 *(pixel++) = (uint8_t)(color & 0xFF);
22}
GLuint color
Definition glad.h:3749
GLuint GLsizei GLsizei * length
Definition glad.h:3372
Here is the caller graph for this function:

◆ mlx_put_pixel()

void mlx_put_pixel ( mlx_image_t image,
uint32_t  x,
uint32_t  y,
uint32_t  color 
)

Sets / puts a pixel onto an image.

NOTE: It is considered undefined behaviour when putting a pixel beyond the bounds of an image.

Parameters
[in]imageThe MLX instance handle.
[in]xThe X coordinate position.
[in]yThe Y coordinate position.
[in]colorThe color value to put.

Definition at line 26 of file mlx_put_pixel.c.

27{
29 MLX_ASSERT(x < image->width, "Pixel is out of bounds");
30 MLX_ASSERT(y < image->height, "Pixel is out of bounds");
31
32 uint8_t* pixelstart = &image->pixels[(y * image->width + x) * BPP];
34}
#define MLX_NONNULL(var)
Definition MLX42_Int.h:46
#define BPP
Definition MLX42_Int.h:42
#define MLX_ASSERT(cond, msg)
Definition MLX42_Int.h:45
GLint y
Definition glad.h:1965
GLint GLsizei GLsizei height
Definition glad.h:1965
GLint GLsizei width
Definition glad.h:1965
GLdouble x
Definition glad.h:2847
GLenum GLenum GLsizei void * image
Definition glad.h:5132
void mlx_draw_pixel(uint8_t *pixel, uint32_t color)
Here is the call graph for this function: