VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bmpmain.h
Go to the documentation of this file.
1 /* © 1998 JRM Technologies, Inc.*/
2 
3 #ifndef _JRMLIBRARY_BMPMAIN_H
4 #define _JRMLIBRARY_BMPMAIN_H
5 
6 #include "JRMlibraryDLLstub.h"
7 #include "JRMlibrary.h"
8 
9 #ifdef __cplusplus
10 extern "C"
11 {
12 #endif
13 
14 
15 #define BIT8 8
16 #define BIT16 16
17 #define WRITE 1
18 #define READ 0
19 #define READ_NORMALIZED 2
20 
21 #define SINGLE_VALID_CHANNEL 1
22 #define LOG_DISPLAY 2
23 #define FIMAGE_MAX 65535.0
24 #define FMAX8BIT 255.0
25 #define FMAX16BIT 65535.0
26 #define COLORS8BIT 256
27 #define COLORS16BIT 65536
28 #define PIXELSPERMETER 2834
29 
30 #define BI_RGB 0L
31 #define BI_RLE8 1L
32 #define BI_RLE4 2L
33 #define BI_BITFIELDS 3L
34 
35 #define SIZEOFbitmapFILEHEADER 14
36 
37  typedef unsigned short USHORT;
38  typedef USHORT *PUSHORT;
39  typedef unsigned char UCHAR;
40 
41 #ifndef LINUX
42  typedef int BOOL;
43  typedef long LONG;
44  typedef unsigned long ULONG;
45  typedef ULONG *PULONG;
46  typedef unsigned long DWORD;
47 #else
48  #if __x86_64__
49  typedef int LONG;
50  typedef unsigned int ULONG;
51  typedef ULONG *PULONG;
52  typedef unsigned int DWORD;
53  #else
54  typedef long LONG;
55  typedef unsigned long ULONG;
56  typedef ULONG *PULONG;
57  typedef unsigned long DWORD;
58  #endif
59 #endif
60  typedef unsigned char BYTE;
61  typedef unsigned short WORD;
62  typedef float FLOAT;
63  typedef FLOAT *PFLOAT;
64 
65 
66  typedef int INT;
67  typedef unsigned int UINT;
68  typedef unsigned int *PUINT;
69 
70  typedef struct {
71  DWORD biSize;
72  LONG biWidth;
73  LONG biHeight;
74  WORD biPlanes;
75  WORD biBitCount;
77  DWORD biSizeImage;
80  DWORD biClrUsed;
83 
84  typedef struct {
85  BYTE rgbBlue;
86  BYTE rgbGreen;
87  BYTE rgbRed;
89  } RGBquad;
90 
91  typedef struct {
94  } bitmapINFO;
95 
96  typedef struct {
97  WORD bfType;
98  DWORD bfSize;
101  DWORD bfOffBits;
103 
104 
105  JRMLIBRARY_API double CardSpline_Step1(double t, double p1, double p2, double p3, double p4);
106  JRMLIBRARY_API void sample_bicubic(double *in, long npts, double *out, long sample_pts);
107  JRMLIBRARY_API void sample_quadratic(double *in, long npts, double *out, long sample_pts);
108  JRMLIBRARY_API double *BiCubic2D(double *array, long *num_cols, long *num_rows, long out_cols, long out_rows);
109  JRMLIBRARY_API void linear_interpolate(double *xin, double *yin, long inpts, double *xout, double *yout, long outpts, double limita, double d);
110  JRMLIBRARY_API double *MirrorImage(double *fimage, long *num_cols, long *num_rows, long mirror_cols, long mirror_rows);
111  JRMLIBRARY_API double *CropImage(double *fimage, long *num_cols, long *num_rows, long crop_cols, long crop_rows, long start_col, long start_row);
112  JRMLIBRARY_API void MirrorFunction(double **x, double **y, long inpts, long outpts);
113  JRMLIBRARY_API void MirrorComplexFunctionUnindexed(COMPLEX **y, long inpts, long outpts);
114  JRMLIBRARY_API void MirrorFunctionUnindexed(double **y, long inpts, long outpts);
115  JRMLIBRARY_API long OutputImage(double *fimage, long num_cols, long num_rows, long out_bit_depth, char *output_file, double gain, double level, long proc_flag);
116  JRMLIBRARY_API long OutputBMPImage2(double *fimage, long num_cols, long num_rows, long out_bit_depth, char *output_file, double gain, double level, long proc_flag);
117  JRMLIBRARY_API unsigned char *ReadWriteBMP(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite,int *err);
118  JRMLIBRARY_API unsigned char *ReadWriteBMP2(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite, double *fmax_in, double *fmin_in);
119 
120  //JRMLIBRARY_API int ReadWriteBMP(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite);
121  JRMLIBRARY_API int Free_BMPImage(double** fimage);
122  JRMLIBRARY_API int hsfilenameBMP(int i, char* io, char* fileaddress); // Adds to string "io" the characters corresponding to the integer i, then adds the ".bmp" suffix, and returns the result in fileaddress.
123  JRMLIBRARY_API double* Create_BMPImage(int num_pixels);
124 
125  // I added this stuff -- MWO / kg
126 
127 #define JRMImage double*
128 #define JRMCImage COMPLEX*
129 
130  JRMLIBRARY_API JRMImage CreateJRMImage(int num_pixels);
131  JRMLIBRARY_API JRMCImage CreateJRMCImage(int num_pixels);
132  JRMLIBRARY_API void FreeJRMImage (JRMImage imagein);
133  JRMLIBRARY_API void FreeJRMCImage (JRMCImage cimagein);
134 
135 
136  /************** Below written by JH, added to SS4.7 CF040302 ****************/
137  typedef struct
138  {
139  short magic;
140  char storage;
141  char bpc;
142  unsigned short dimension, xsize, ysize, zsize;
143  long pixmin, pixmax;
144  char imagename[80];
145  long colormap;
146  } RGBSGIHeader;
147 
148  JRMLIBRARY_API unsigned char freadchar(FILE *fileon) ;
149  JRMLIBRARY_API unsigned short freadshort(FILE *fileon);
150  JRMLIBRARY_API unsigned long freadlong(FILE *fileon);
151  JRMLIBRARY_API void fwritechar(unsigned char charin, FILE *fileon);
152  JRMLIBRARY_API void fwriteshort(unsigned short shortin, FILE *fileon);
153  JRMLIBRARY_API void fwritelong(unsigned long longin, FILE *fileon);
154  JRMLIBRARY_API int expandrow(double *optr, unsigned char *iptr);
155  JRMLIBRARY_API double *ReadSGIRGB(char *filename, RGBSGIHeader *headeron);
156  JRMLIBRARY_API void WriteSGIRGB(char *filename, double *pixeldata, RGBSGIHeader *headeron);
157 
158  /* For reading fpf files */
159  JRMLIBRARY_API int *ReadFPFFileInt(char *filename, int width, int height);
160  JRMLIBRARY_API double *ReadFPFFileDouble(char *filename, int width, int height);
161  JRMLIBRARY_API float *ReadFPFFileFloat(char *filename, int width, int height);
162  JRMLIBRARY_API void WriteFPFFileInt(char *filename, int *idata, int width, int height);
163  JRMLIBRARY_API void WriteFPFFileDouble(char *filename, double *ddata, int width, int height);
164  JRMLIBRARY_API void WriteFPFFileFloat(char *filename, float *fdata, int width, int height);
165  JRMLIBRARY_API void FreeFPFInt(int **data);
166  JRMLIBRARY_API void FreeFPFDouble(double **data);
167  JRMLIBRARY_API void FreeFPFFloat(float **data);
168 
169 
170  JRMLIBRARY_API lVEC_HV GetImageStatistics(int objectID, lVEC_HV *window_center, lVEC_HV window_extents, lVEC_HV image_extents, int objectIDDepth, int radianceDepth, double *objectidMap, double *radianceMap, double *avet, double *devt, double *numt, double *aveb, double *devb, double *numb);
171  JRMLIBRARY_API double averageimage(double *imagein, long num_cols, long num_rows, unsigned short bit_depth, double rmax, double rmin);
172 
173 
174  /************** Below written by CF SS4.9 CF060928 ********************/
175 
176 
177  JRMLIBRARY_API int ConvertCIED65toGivenSpectralDomain(long nlambda, double *lambda, double *CIED65);
178  JRMLIBRARY_API int MultiplyReflectivityByCIED65(long nlambda, double *lambda, double *reflectivity, double *CIEspectrum);
179  JRMLIBRARY_API double SpectralRadiance2Luminance(double lambda_um, double radiance_Wm2srum);
180  JRMLIBRARY_API double SpectralRadiance2LuminanceVstar(double lambda_um, double radiance_Wm2srum);
181  JRMLIBRARY_API int ConvertCIECMFtoGivenSpectralDomain(long nlambda, double *lambda, double *CIEX, double *CIEY, double *CIEZ);
182  JRMLIBRARY_API int CIEXYZforSpectrum(long nlambda, double *lambda, double *spectrum, double *X, double *Y, double *Z);
183  JRMLIBRARY_API double Clinear2Csrgb(double Clinear);
185  JRMLIBRARY_API int GetCIEsRGBfromReflectivitySpectrum(long nlambda, double *lambda, double *reflectivity, VECTOR *RGB);
187 
188 
189  /* ------------- N-Dim HSL Transform -------------------- */
192  JRMLIBRARY_API jrmbool SpectrumTransformToScaledSphericalGrayAxisSystem(double* input, int depth, double maxpixelvalue, double satweight, double lumweight); // main RGB to HSL call
193 
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif // _JRMLIBRARY_BMPMAIN_H


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)