| # readtex
Includes: | <stdio.h>
## Introduction Texture loading from file. ##### Discussion readtex forms one part of the Eden library. ## Functions `jpgread` Read a JPEG file and return it as a raw buffer. `ReadTex` Read an image file and return it as a raw buffer. ### jpgread Read a JPEG file and return it as a raw buffer.
    unsigned char *jpgread (
        FILE *fp,
        int *w,
        int *h,
        int *nc,
        float *dpi);
##### Parameters `fp` File pointer to open jpeg file. `w` Pointer to location which will be filled with the width of the JPEG image in pixels, or NULL if this is not required. `h` Pointer to location which will be filled with the width of the JPEG image in pixels, or NULL if this is not required. `nc` Pointer to location which will be filled with the number of components in the JPEG image in pixels, or NULL if this is not required. `dpi` Pointer to location which will be filled with the resolution of the jpeg in dots-per-inch, or NULL if this is not required. ##### Return Value A raw buffer holding the jpeg data, beginning with the first component of the leftmost pixel of the uppermost scanline, and continuing by component, pixel, and line. This buffer must be free()d when finished with. ##### Discussion Reads a JPEG image from a file into a raw buffer. JPEGs in mono and RGB format are supported. ### ReadTex Read an image file and return it as a raw buffer.
    extern unsigned char *ReadTex(
        const char *imageFile,
        int *w,
        int *h,
        int *nc);
##### Parameters `imageFile` name of image to read. At present, images in SGI format (.sgi or .rgb) and JPEG format (.jpg or .jpeg) are supported. `w` Pointer to location which will be filled with the width of the image in pixels, or NULL if this is not required. `h` Pointer to location which will be filled with the width of the image in pixels, or NULL if this is not required. `nc` Pointer to location which will be filled with the number of components in the image in pixels, or NULL if this is not required. ##### Return Value A raw buffer holding the image data, beginning with the first component of the leftmost pixel of the uppermost scanline, and continuing by component, pixel, and line. This buffer must be free()d when finished with. © 2001-2013 Philip Lamb Last Updated: Monday, October 05, 2015