00001
00002 #ifndef vil1_image_impl_h_
00003 #define vil1_image_impl_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <vcl_cassert.h>
00023 #include <vcl_string.h>
00024
00025 class vil1_image;
00026
00027
00028
00029
00030 enum vil1_component_format
00031 {
00032 VIL1_COMPONENT_FORMAT_UNKNOWN,
00033 VIL1_COMPONENT_FORMAT_UNSIGNED_INT,
00034 VIL1_COMPONENT_FORMAT_SIGNED_INT,
00035 VIL1_COMPONENT_FORMAT_IEEE_FLOAT,
00036 VIL1_COMPONENT_FORMAT_COMPLEX
00037 };
00038
00039 inline
00040 const char* vil1_print(vil1_component_format f)
00041 {
00042 switch (f)
00043 {
00044 case VIL1_COMPONENT_FORMAT_UNKNOWN: return "VIL1_COMPONENT_FORMAT=UNKNOWN";
00045 case VIL1_COMPONENT_FORMAT_UNSIGNED_INT: return "VIL1_COMPONENT_FORMAT=unsigned int";
00046 case VIL1_COMPONENT_FORMAT_SIGNED_INT: return "VIL1_COMPONENT_FORMAT=signed int";
00047 case VIL1_COMPONENT_FORMAT_IEEE_FLOAT: return "VIL1_COMPONENT_FORMAT=IEEE float";
00048 case VIL1_COMPONENT_FORMAT_COMPLEX: return "VIL1_COMPONENT_FORMAT=complex";
00049 default: return "VIL1_COMPONENT_FORMAT_INVALID";
00050 }
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 class vil1_image_impl
00088 {
00089 public:
00090
00091
00092 vil1_image_impl() : reference_count(0) {}
00093 virtual ~vil1_image_impl() {}
00094
00095
00096 virtual int planes() const = 0;
00097
00098 virtual int width() const = 0;
00099
00100 virtual int height() const = 0;
00101
00102 virtual int components() const = 0;
00103
00104
00105
00106 virtual int bits_per_component() const = 0;
00107
00108
00109
00110
00111
00112
00113
00114 virtual enum vil1_component_format component_format() const = 0;
00115
00116
00117 virtual vil1_image get_plane(unsigned int p) const;
00118
00119
00120
00121
00122
00123
00124 virtual bool get_section(void* buf, int x0, int y0, int width, int height) const = 0;
00125
00126
00127
00128
00129
00130
00131 virtual bool put_section(void const* buf, int x0, int y0, int width, int height) = 0;
00132
00133
00134
00135 virtual char const* file_format() const { return 0; }
00136
00137
00138 virtual bool get_property(char const* tag, void* property_value = 0) const;
00139 virtual bool set_property(char const* tag, void const* property_value = 0) const;
00140
00141
00142 virtual vcl_string is_a() const { return "vil1_image_impl"; }
00143
00144
00145 virtual bool is_class(vcl_string const& s) const { return s==is_a(); }
00146
00147 private:
00148 friend class vil1_image;
00149
00150
00151 void up_ref() { ++reference_count; }
00152 void down_ref()
00153 {
00154 assert(reference_count>0);
00155 if (--reference_count<=0) delete this;
00156 }
00157 int reference_count;
00158 };
00159
00160 #define VIL1_DISPATCH_AUX(VTYPE, uchar, Template, Args) \
00161 case VTYPE: Template<uchar > Args; break;
00162
00163 #define VIL1_DISPATCH_IMAGE_OP(f, Template, Args) \
00164 switch (f) {\
00165 VIL1_DISPATCH_AUX(VIL1_UNSIGNED_8, vil1_unsigned_8);\
00166 VIL1_DISPATCH_AUX(VIL1_SIGNED_8, vil1_signed_8); \
00167 VIL1_DISPATCH_AUX(VIL1_FLOAT_32, vil1_float_32); \
00168 }
00169
00170 #endif // vil1_image_impl_h_