JWS C Library
C language utility library
|
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 00052 #ifndef IMGBLOCK_H 00053 #define IMGBLOCK_H 00054 00055 00056 #include <jwsc/config.h> 00057 00058 #include <stdlib.h> 00059 #include <inttypes.h> 00060 00061 #include "jwsc/base/error.h" 00062 #include "jwsc/matblock/matblock.h" 00063 #include "jwsc/image/image.h" 00064 00065 00066 #ifdef __cplusplus 00067 namespace jwsc { 00068 extern "C" { 00069 #endif 00070 00071 00073 typedef struct Imgblock_f 00074 { 00076 uint32_t num_imgs; 00077 00079 uint32_t num_rows; 00080 00082 uint32_t num_cols; 00083 00085 Pixel_f*** pxls; 00086 } 00087 Imgblock_f; 00088 00089 00091 typedef enum 00092 { 00093 IMGBLOCK_IMG_IMAGE, 00094 IMGBLOCK_ROW_IMAGE, 00095 IMGBLOCK_COL_IMAGE 00096 } 00097 Imgblock_image; 00098 00099 00108 void create_imgblock_f 00109 ( 00110 Imgblock_f** img_out, 00111 uint32_t num_imgs, 00112 uint32_t num_rows, 00113 uint32_t num_cols 00114 ); 00115 00132 void create_init_imgblock_f 00133 ( 00134 Imgblock_f** img_out, 00135 uint32_t num_imgs, 00136 uint32_t num_rows, 00137 uint32_t num_cols, 00138 Pixel_f val 00139 ); 00140 00157 void create_zero_imgblock_f 00158 ( 00159 Imgblock_f** img_out, 00160 uint32_t num_imgs, 00161 uint32_t num_rows, 00162 uint32_t num_cols 00163 ); 00164 00181 void create_random_imgblock_f 00182 ( 00183 Imgblock_f** img_out, 00184 uint32_t num_imgs, 00185 uint32_t num_rows, 00186 uint32_t num_cols, 00187 Pixel_f min, 00188 Pixel_f max 00189 ); 00190 00207 Error* create_imgblock_from_matblocks_f 00208 ( 00209 Imgblock_f** img_out, 00210 const Matblock_f* m_r, 00211 const Matblock_f* m_g, 00212 const Matblock_f* m_b 00213 ); 00214 00231 void create_imgblock_from_matblock_f 00232 ( 00233 Imgblock_f** img_out, 00234 const Matblock_f* m 00235 ); 00236 00253 void create_matblocks_from_imgblock_f 00254 ( 00255 Matblock_f** m_r_out, 00256 Matblock_f** m_g_out, 00257 Matblock_f** m_b_out, 00258 const Imgblock_f* img 00259 ); 00260 00277 void create_matblock_from_imgblock_f 00278 ( 00279 Matblock_f** m_out, 00280 const Imgblock_f* img, 00281 float r_weight, 00282 float g_weight, 00283 float b_weight 00284 ); 00285 00299 void copy_imgblock_f(Imgblock_f** img_out, const Imgblock_f* img_in); 00300 00314 Error* copy_image_into_imgblock_f 00315 ( 00316 Imgblock_f** ib_out, 00317 const Imgblock_f* ib_in, 00318 const Image_f* i, 00319 Imgblock_image orient, 00320 uint32_t index 00321 ); 00322 00337 Error* copy_image_from_imgblock_f 00338 ( 00339 Image_f** i_out, 00340 const Imgblock_f* ib, 00341 Imgblock_image orient, 00342 uint32_t index 00343 ); 00344 00358 void free_imgblock_f(Imgblock_f* img); 00359 00363 #ifdef __cplusplus 00364 } 00365 } 00366 #endif 00367 00368 00369 #endif