removed reference to Glut and OpenGL
This commit is contained in:
		
							parent
							
								
									8722f52a98
								
							
						
					
					
						commit
						90d4b0cfc3
					
				
							
								
								
									
										24
									
								
								src/ppm.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/ppm.c
									
									
									
									
									
								
							@ -106,13 +106,13 @@ void read_rgb(FILE* t_fp, const char* t_filename) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned long read_data(FILE *t_fp, Image *t_img, GLubyte **t_data,
 | 
					unsigned long read_data(FILE *t_fp, Image *t_img, unsigned char **t_data,
 | 
				
			||||||
                        const char *t_filename) {
 | 
					                        const char *t_filename) {
 | 
				
			||||||
  unsigned long size;
 | 
					  unsigned long size;
 | 
				
			||||||
  /* allocation memoire */
 | 
					  /* allocation memoire */
 | 
				
			||||||
  size = t_img->x * t_img->y * 3;
 | 
					  size = t_img->x * t_img->y * 3;
 | 
				
			||||||
  printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, size);
 | 
					  printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, size);
 | 
				
			||||||
  *t_data = (GLubyte *)malloc((size_t)size * sizeof(GLubyte));
 | 
					  *t_data = (unsigned char *)malloc((size_t)size * sizeof(unsigned char));
 | 
				
			||||||
  assert(*t_data);
 | 
					  assert(*t_data);
 | 
				
			||||||
  /* read pixel data from file */
 | 
					  /* read pixel data from file */
 | 
				
			||||||
  if (!fread(*t_data, (size_t)1, (size_t)size, t_fp)) {
 | 
					  if (!fread(*t_data, (size_t)1, (size_t)size, t_fp)) {
 | 
				
			||||||
@ -124,17 +124,17 @@ unsigned long read_data(FILE *t_fp, Image *t_img, GLubyte **t_data,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *  Convertit vers un tableau de `GLubyte` les pixels contenus dans un conteneur
 | 
					 *  Convertit vers un tableau de `unsigned char` les pixels contenus dans un conteneur
 | 
				
			||||||
 *  d’image. La taille du tableau de `GLubyte` est la taille du tableau de
 | 
					 *  d’image. La taille du tableau de `unsigned char` est la taille du tableau de
 | 
				
			||||||
 *  pixels multipliée par trois du fait des trois emplacements séparés par
 | 
					 *  pixels multipliée par trois du fait des trois emplacements séparés par
 | 
				
			||||||
 *  couleur.
 | 
					 *  couleur.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *  \param[out] img Image dont les pixels doivent être convertis
 | 
					 *  \param[out] img Image dont les pixels doivent être convertis
 | 
				
			||||||
 *  \param[in] data Données à convertir en structures \ref Pixel
 | 
					 *  \param[in] data Données à convertir en structures \ref Pixel
 | 
				
			||||||
 *  \param[in] size Taille du tableau de `GLubyte`
 | 
					 *  \param[in] size Taille du tableau de `unsigned char`
 | 
				
			||||||
 *  \return return type
 | 
					 *  \return return type
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void dataToImage(Image *t_img, GLubyte *t_data, unsigned long t_size) {
 | 
					void dataToImage(Image *t_img, unsigned char *t_data, unsigned long t_size) {
 | 
				
			||||||
  unsigned long i;
 | 
					  unsigned long i;
 | 
				
			||||||
  t_img->pixels = darrayNew(sizeof(Pixel));
 | 
					  t_img->pixels = darrayNew(sizeof(Pixel));
 | 
				
			||||||
  printf("Size of data: %lu\n", t_size);
 | 
					  printf("Size of data: %lu\n", t_size);
 | 
				
			||||||
@ -153,12 +153,12 @@ void dataToImage(Image *t_img, GLubyte *t_data, unsigned long t_size) {
 | 
				
			|||||||
 *  \param[in] img Conteneur d’image contenant les pixels à convertir
 | 
					 *  \param[in] img Conteneur d’image contenant les pixels à convertir
 | 
				
			||||||
 *  \return Tableau de pointeurs de `GLuint`
 | 
					 *  \return Tableau de pointeurs de `GLuint`
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
GLubyte *imageToData(Image_t t_img) {
 | 
					unsigned char *imageToData(Image_t t_img) {
 | 
				
			||||||
  Pixel_t pixel;
 | 
					  Pixel_t pixel;
 | 
				
			||||||
  GLubyte *data, size;
 | 
					  unsigned char *data, size;
 | 
				
			||||||
  unsigned long i;
 | 
					  unsigned long i;
 | 
				
			||||||
  size = (GLubyte)darraySize(t_img->pixels);
 | 
					  size = (unsigned char)darraySize(t_img->pixels);
 | 
				
			||||||
  data = (GLubyte *)malloc(3 * sizeof(GLubyte) * size);
 | 
					  data = (unsigned char *)malloc(3 * sizeof(unsigned char) * size);
 | 
				
			||||||
  for(i = 0; i < size; i += 3) {
 | 
					  for(i = 0; i < size; i += 3) {
 | 
				
			||||||
    pixel = darrayGet(t_img->pixels, i / 3);
 | 
					    pixel = darrayGet(t_img->pixels, i / 3);
 | 
				
			||||||
    data[i] = pixel->r;
 | 
					    data[i] = pixel->r;
 | 
				
			||||||
@ -181,7 +181,7 @@ GLubyte *imageToData(Image_t t_img) {
 | 
				
			|||||||
int imageLoadPPM(const char *t_filename, Image *t_img) {
 | 
					int imageLoadPPM(const char *t_filename, Image *t_img) {
 | 
				
			||||||
  FILE *fp;
 | 
					  FILE *fp;
 | 
				
			||||||
  unsigned long size;
 | 
					  unsigned long size;
 | 
				
			||||||
  GLubyte *data = NULL;
 | 
					  unsigned char *data = NULL;
 | 
				
			||||||
  printf("Hey auie\n");
 | 
					  printf("Hey auie\n");
 | 
				
			||||||
  fp = get_file(t_filename, "rb");       /* open PPM file for reading */
 | 
					  fp = get_file(t_filename, "rb");       /* open PPM file for reading */
 | 
				
			||||||
  read_file_format(fp, t_filename);      /* read image format */
 | 
					  read_file_format(fp, t_filename);      /* read image format */
 | 
				
			||||||
@ -203,7 +203,7 @@ int imageLoadPPM(const char *t_filename, Image *t_img) {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
void imageSavePPM(char *t_filename, Image_t t_img) {
 | 
					void imageSavePPM(char *t_filename, Image_t t_img) {
 | 
				
			||||||
  FILE *fp;
 | 
					  FILE *fp;
 | 
				
			||||||
  GLubyte *data;
 | 
					  unsigned char *data;
 | 
				
			||||||
  fp = get_file(t_filename, "wb"); /* open file for output */
 | 
					  fp = get_file(t_filename, "wb"); /* open file for output */
 | 
				
			||||||
  /* write the header file */
 | 
					  /* write the header file */
 | 
				
			||||||
  fprintf(fp, "P6\n");                          /* image format */
 | 
					  fprintf(fp, "P6\n");                          /* image format */
 | 
				
			||||||
 | 
				
			|||||||
@ -23,12 +23,12 @@ void read_file_size(FILE *fp, Image *img, const char *filename);
 | 
				
			|||||||
/// \brief Lit et vérifie le format RGB du fichier ppm
 | 
					/// \brief Lit et vérifie le format RGB du fichier ppm
 | 
				
			||||||
void read_rgb(FILE *fp, const char *filename);
 | 
					void read_rgb(FILE *fp, const char *filename);
 | 
				
			||||||
/// \brief Lit dans le conteneur les données images du fichier ppm
 | 
					/// \brief Lit dans le conteneur les données images du fichier ppm
 | 
				
			||||||
unsigned long read_data(FILE *fp, Image *img, GLubyte **data,
 | 
					unsigned long read_data(FILE *fp, Image *img, unsigned char **data,
 | 
				
			||||||
                        const char *filename);
 | 
					                        const char *filename);
 | 
				
			||||||
/// \brief Convertit les données brutes de fichier vers des conteneurs de pixels
 | 
					/// \brief Convertit les données brutes de fichier vers des conteneurs de pixels
 | 
				
			||||||
void dataToImage(Image *img, GLubyte *data, unsigned long size);
 | 
					void dataToImage(Image *img, unsigned char *data, unsigned long size);
 | 
				
			||||||
/// \brief Convertit les pixels d’une image en tableau natif OpenGL
 | 
					/// \brief Convertit les pixels d’une image en tableau natif OpenGL
 | 
				
			||||||
GLubyte *imageToData(Image_t img);
 | 
					unsigned char *imageToData(Image_t img);
 | 
				
			||||||
/// \brief Ouverture et lecture de l’image d’entrée
 | 
					/// \brief Ouverture et lecture de l’image d’entrée
 | 
				
			||||||
int imageLoadPPM(const char *filename, Image_t img);
 | 
					int imageLoadPPM(const char *filename, Image_t img);
 | 
				
			||||||
/// \brief Ouverture et écriture de l'image de sortie
 | 
					/// \brief Ouverture et écriture de l'image de sortie
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@
 | 
				
			|||||||
#define UTILITIES_H
 | 
					#define UTILITIES_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "darray.h"
 | 
					#include "darray.h"
 | 
				
			||||||
#include <GL/gl.h>
 | 
					/* #include <GL/gl.h> */
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user