72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
#ifndef IMGIO_H
|
|
#define IMGIO_H
|
|
|
|
#include "utils.h"
|
|
|
|
/**
|
|
* @brief Open and Fill buffer from .ppm file
|
|
* @param [in] file Char pointer use to locate the image to be modified lays.
|
|
* @param [in,out] m_attr PPM pointer to store image information
|
|
*/
|
|
unsigned int*
|
|
read_ppm(const char* file, PPM* m_attr);
|
|
|
|
/**
|
|
* @brief Open and write buffer to file
|
|
* @param [in] buf Information of pixels
|
|
* @param [in] img PPM pointer to store image information
|
|
* @param [in] char Name/Location for file
|
|
*/
|
|
int
|
|
write_ppm(const unsigned int* buf, const PPM img, const char* name);
|
|
|
|
/**
|
|
* @brief Open and Fill buffer from .jpg file
|
|
* @details Opens a .jpg file, creates a new buffer and extracts the pixels into
|
|
* said buffer as integers.
|
|
* @param [in] file Char pointer use to locate the image to be modified lays.
|
|
* @param [in,out] m_attr JPEG pointer to store image information
|
|
*/
|
|
unsigned int*
|
|
read_jpeg(JPEG* m_attr);
|
|
|
|
/**
|
|
* @brief Open and write buffer to file
|
|
* @param [in] buf Information of pixels
|
|
* @param [in] attr JPEG pointer to store image information
|
|
* @param [in] char Name/Location for file
|
|
*/
|
|
int
|
|
write_jpeg(const unsigned int* src_buf, const JPEG* attr, const char* name);
|
|
|
|
/**
|
|
* @brief Converts PPM to JPEG
|
|
* @param [in] in Pointer to PPM container
|
|
*/
|
|
void
|
|
transcode_to_jpeg(PPM* in);
|
|
|
|
/**
|
|
* @brief Converts JPEG to PPM
|
|
* @param [in] in Pointer to JPEG container
|
|
*/
|
|
void
|
|
transcode_to_ppm(JPEG* in);
|
|
|
|
/**
|
|
* @brief Inherits the attributes from JPEG container
|
|
* @param [in] in Pointer to JPEG container
|
|
* @param [in] fmt Character for type of PPM image, binary or raw
|
|
*/
|
|
PPM
|
|
inherit_from_jpeg(const JPEG* in, const char fmt);
|
|
|
|
/**
|
|
* @brief Inherits the attributes from PPM container
|
|
* @param [in] in Pointer to PPM container
|
|
*/
|
|
JPEG
|
|
inherit_from_ppm(const PPM* in);
|
|
|
|
#endif
|