JWS C Library
C language utility library
jiff.h
Go to the documentation of this file.
00001 /*
00002  * This work is licensed under a Creative Commons 
00003  * Attribution-Noncommercial-Share Alike 3.0 United States License.
00004  * 
00005  *    http://creativecommons.org/licenses/by-nc-sa/3.0/us/
00006  * 
00007  * You are free:
00008  * 
00009  *    to Share - to copy, distribute, display, and perform the work
00010  *    to Remix - to make derivative works
00011  * 
00012  * Under the following conditions:
00013  * 
00014  *    Attribution. You must attribute the work in the manner specified by the
00015  *    author or licensor (but not in any way that suggests that they endorse you
00016  *    or your use of the work).
00017  * 
00018  *    Noncommercial. You may not use this work for commercial purposes.
00019  * 
00020  *    Share Alike. If you alter, transform, or build upon this work, you may
00021  *    distribute the resulting work only under the same or similar license to
00022  *    this one.
00023  * 
00024  * For any reuse or distribution, you must make clear to others the license
00025  * terms of this work. The best way to do this is by including this header.
00026  * 
00027  * Any of the above conditions can be waived if you get permission from the
00028  * copyright holder.
00029  * 
00030  * Apart from the remix rights granted under this license, nothing in this
00031  * license impairs or restricts the author's moral rights.
00032  */
00033 
00034 
00049 #ifndef JIFF_H
00050 #define JIFF_H
00051 
00052 
00053 #include <jwsc/config.h>
00054 
00055 #include <stdlib.h>
00056 
00057 #include "jwsc/base/error.h"
00058 #include "jwsc/image/image.h"
00059 
00060 
00061 #ifdef __cplusplus
00062 namespace jwsc {
00063 extern "C" {
00064 #endif
00065 
00066 
00068 typedef enum
00069 {
00070     JIFF_GRAY,     
00071     JIFF_RGB       
00072 } 
00073 JIFF_colorspace;
00074 
00075 
00077 typedef enum 
00078 {
00079     JIFF_8_BIT,  
00080     JIFF_16_BIT, 
00081     JIFF_32_BIT  
00082 }
00083 JIFF_depth;
00084 
00085 
00087 typedef enum 
00088 {
00089     JIFF_INTEGER,  
00090     JIFF_FLOAT     
00091 }
00092 JIFF_type;
00093 
00094 
00096 typedef struct
00097 {
00099     JIFF_colorspace  colorspace;
00100 
00102     JIFF_depth  depth;
00103 
00105     JIFF_type  type;
00106 
00108     float red_w;
00109 
00111     float green_w;
00112 
00114     float blue_w;
00115 }
00116 JIFF_attributes;
00117 
00118 
00120 void init_jiff_attributes(JIFF_attributes* attrs);
00121 
00122 
00124 Error* read_image_as_jiff_f(Image_f** img_out, const char* fname);
00125 
00126 
00128 Error* write_image_as_jiff_f
00129 (
00130     const Image_f*         img, 
00131     const char*            fname, 
00132     const JIFF_attributes* attrs
00133 );
00134 
00135 
00136 #ifdef __cplusplus
00137 }
00138 }
00139 #endif
00140 
00141 
00142 #endif