Añadiendo mlx

This commit is contained in:
2025-11-14 15:10:19 +01:00
parent 06267858e8
commit 5c40a00540
61 changed files with 27644 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* mlx_texture.c :+: :+: */
/* +:+ */
/* By: W2Wizard <main@w2wizard.dev> +#+ */
/* +#+ */
/* Created: 2022/02/17 01:02:24 by W2Wizard #+# #+# */
/* Updated: 2023/03/09 11:03:47 by W2Wizard ######## odam.nl */
/* */
/* ************************************************************************** */
#include "MLX42/MLX42_Int.h"
//= Public =//
mlx_image_t* mlx_texture_to_image(mlx_t* mlx, mlx_texture_t* texture)
{
MLX_NONNULL(mlx);
MLX_NONNULL(texture);
mlx_image_t* image = mlx_new_image(mlx, texture->width, texture->height);
if (image == NULL)
return (NULL);
uint8_t* pixelx;
uint8_t* pixeli;
for (uint32_t i = 0; i < texture->height; i++)
{
pixelx = &texture->pixels[(i * texture->width) * texture->bytes_per_pixel];
pixeli = &image->pixels[(i * image->width) * texture->bytes_per_pixel];
memmove(pixeli, pixelx, texture->width * texture->bytes_per_pixel);
}
return (image);
}
void mlx_delete_texture(mlx_texture_t* texture)
{
MLX_NONNULL(texture);
mlx_freen(2, texture->pixels, texture);
}