OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
fieldimage.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #ifndef CMZN_FIELDIMAGE_HPP__
10 #define CMZN_FIELDIMAGE_HPP__
11 
12 #include "zinc/fieldimage.h"
13 #include "zinc/field.hpp"
14 #include "zinc/fieldmodule.hpp"
15 
16 namespace OpenCMISS
17 {
18 namespace Zinc
19 {
20 
21 class StreaminformationImage;
22 
31 class FieldImage : public Field
32 {
33 private:
34 
40  inline cmzn_field_image_id getDerivedId()
41  {
42  return reinterpret_cast<cmzn_field_image_id>(id);
43  }
44 
45 public:
46 
47  FieldImage() : Field()
48  { }
49 
50  // takes ownership of C handle, responsibility for destroying it
51  explicit FieldImage(cmzn_field_image_id field_image_id) :
52  Field(reinterpret_cast<cmzn_field_id>(field_image_id))
53  { }
54 
64  {
65  COMBINE_MODE_INVALID = CMZN_FIELD_IMAGE_COMBINE_MODE_INVALID,
67  COMBINE_MODE_BLEND = CMZN_FIELD_IMAGE_COMBINE_MODE_BLEND,
72  COMBINE_MODE_DECAL = CMZN_FIELD_IMAGE_COMBINE_MODE_DECAL,
81  COMBINE_MODE_MODULATE = CMZN_FIELD_IMAGE_COMBINE_MODE_MODULATE,
87  COMBINE_MODE_ADD = CMZN_FIELD_IMAGE_COMBINE_MODE_ADD,
93  COMBINE_MODE_ADD_SIGNED = CMZN_FIELD_IMAGE_COMBINE_MODE_ADD_SIGNED,
99  COMBINE_MODE_MODULATE_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_MODULATE_SCALE_4,
105  COMBINE_MODE_BLEND_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_BLEND_SCALE_4,
110  COMBINE_MODE_SUBTRACT = CMZN_FIELD_IMAGE_COMBINE_MODE_SUBTRACT,
116  COMBINE_MODE_ADD_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_ADD_SCALE_4,
121  COMBINE_MODE_SUBTRACT_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_SUBTRACT_SCALE_4,
126  COMBINE_MODE_INVERT_ADD_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_INVERT_ADD_SCALE_4,
132  COMBINE_MODE_INVERT_SUBTRACT_SCALE_4 = CMZN_FIELD_IMAGE_COMBINE_MODE_INVERT_SUBTRACT_SCALE_4
138  };
139 
145  {
146  FILTER_MODE_INVALID = CMZN_FIELD_IMAGE_FILTER_MODE_INVALID,
148  FILTER_MODE_NEAREST = CMZN_FIELD_IMAGE_FILTER_MODE_NEAREST,
152  FILTER_MODE_LINEAR = CMZN_FIELD_IMAGE_FILTER_MODE_LINEAR,
156  FILTER_MODE_NEAREST_MIPMAP_NEAREST = CMZN_FIELD_IMAGE_FILTER_MODE_NEAREST_MIPMAP_NEAREST,
160  FILTER_MODE_LINEAR_MIPMAP_NEAREST = CMZN_FIELD_IMAGE_FILTER_MODE_LINEAR_MIPMAP_NEAREST,
164  FILTER_MODE_LINEAR_MIPMAP_LINEAR = CMZN_FIELD_IMAGE_FILTER_MODE_LINEAR_MIPMAP_LINEAR
169  };
170 
177  {
178  HARDWARE_COMPRESSION_MODE_INVALID = CMZN_FIELD_IMAGE_HARDWARE_COMPRESSION_MODE_INVALID,
180  HARDWARE_COMPRESSION_MODE_UNCOMPRESSED = CMZN_FIELD_IMAGE_HARDWARE_COMPRESSION_MODE_UNCOMPRESSED,
183  HARDWARE_COMPRESSION_MODE_AUTOMATIC = CMZN_FIELD_IMAGE_HARDWARE_COMPRESSION_MODE_AUTOMATIC
186  };
187 
192  enum WrapMode
193  {
194  WRAP_MODE_INVALID = CMZN_FIELD_IMAGE_WRAP_MODE_INVALID,
196  WRAP_MODE_CLAMP = CMZN_FIELD_IMAGE_WRAP_MODE_CLAMP,
198  WRAP_MODE_REPEAT = CMZN_FIELD_IMAGE_WRAP_MODE_REPEAT,
202  WRAP_MODE_EDGE_CLAMP = CMZN_FIELD_IMAGE_WRAP_MODE_EDGE_CLAMP,
205  WRAP_MODE_BORDER_CLAMP= CMZN_FIELD_IMAGE_WRAP_MODE_BORDER_CLAMP,
207  WRAP_MODE_MIRROR_REPEAT = CMZN_FIELD_IMAGE_WRAP_MODE_MIRROR_REPEAT
211  };
212 
219  {
220  return cmzn_field_image_get_width_in_pixels(getDerivedId());
221  }
222 
229  {
230  return cmzn_field_image_get_height_in_pixels(getDerivedId());
231  }
232 
239  {
240  return cmzn_field_image_get_depth_in_pixels(getDerivedId());
241  }
242 
253  int getSizeInPixels(int valuesCount, int *valuesOut)
254  {
255  return cmzn_field_image_get_size_in_pixels(getDerivedId(), valuesCount, valuesOut);
256  }
257 
264  {
265  return cmzn_field_image_get_texture_coordinate_width(getDerivedId());
266  }
267 
274  {
275  return cmzn_field_image_get_texture_coordinate_height(getDerivedId());
276  }
277 
284  {
285  return cmzn_field_image_get_texture_coordinate_depth(getDerivedId());
286  }
287 
297  int getTextureCoordinateSizes(int valuesCount, double *valuesOut)
298  {
299  return cmzn_field_image_get_texture_coordinate_sizes(getDerivedId(), valuesCount,
300  valuesOut);
301  }
302 
310  int setTextureCoordinateWidth(double width)
311  {
312  return cmzn_field_image_set_texture_coordinate_width(getDerivedId(), width);
313  }
314 
322  int setTextureCoordinateHeight(double height)
323  {
324  return cmzn_field_image_set_texture_coordinate_height(getDerivedId(), height);
325  }
326 
334  int setTextureCoordinateDepth(double depth)
335  {
336  return cmzn_field_image_set_texture_coordinate_depth(getDerivedId(), depth);
337  }
338 
348  int setTextureCoordinateSizes(int valuesCount, const double *valuesIn)
349  {
350  return cmzn_field_image_set_texture_coordinate_sizes(getDerivedId(),
351  valuesCount, valuesIn);
352  }
353 
369  inline int read(const StreaminformationImage& streaminformationImage);
370 
380  int readFile(const char *fileName)
381  {
382  return cmzn_field_image_read_file(getDerivedId(), fileName);
383  }
384 
404  inline int write(const StreaminformationImage& streaminformationImage);
405 
412  {
413  return static_cast<CombineMode>(cmzn_field_image_get_combine_mode(getDerivedId()));
414  }
415 
423  int setCombineMode(CombineMode combineMode)
424  {
425  return cmzn_field_image_set_combine_mode(getDerivedId(),
426  static_cast<cmzn_field_image_combine_mode>(combineMode));
427  }
428 
437  {
438  return Field(cmzn_field_image_get_domain_field(getDerivedId()));
439  }
440 
450  int setDomainField(const Field& domainField)
451  {
452  return cmzn_field_image_set_domain_field(getDerivedId(), domainField.getId());
453  }
454 
461  {
462  return static_cast<HardwareCompressionMode>(
463  cmzn_field_image_get_hardware_compression_mode(getDerivedId()));
464  }
465 
475  {
476  return cmzn_field_image_set_hardware_compression_mode(getDerivedId(),
477  static_cast<cmzn_field_image_hardware_compression_mode>(hardwareCompressionMode));
478  }
479 
486  {
487  return static_cast<FilterMode>(cmzn_field_image_get_filter_mode(getDerivedId()));
488  }
489 
498  int setFilterMode(FilterMode filterMode)
499  {
500  return cmzn_field_image_set_filter_mode(getDerivedId(),
501  static_cast<cmzn_field_image_filter_mode>(filterMode));
502  }
503 
510  {
511  return static_cast<WrapMode>(cmzn_field_image_get_wrap_mode(getDerivedId()));
512  }
513 
521  int setWrapMode(WrapMode wrapMode)
522  {
523  return cmzn_field_image_set_wrap_mode(getDerivedId(),
524  static_cast<cmzn_field_image_wrap_mode>(wrapMode));
525  }
526 
536  char *getProperty(const char* property)
537  {
538  return cmzn_field_image_get_property(getDerivedId(), property);
539  }
540 
548 
549 };
550 
552 {
553  return FieldImage(reinterpret_cast<cmzn_field_image_id>(
554  cmzn_fieldmodule_create_field_image(id)));
555 }
556 
558 {
559  return FieldImage(reinterpret_cast<cmzn_field_image_id>(
560  cmzn_fieldmodule_create_field_image_from_source(id, sourceField.getId())));
561 }
562 
564 {
565  return FieldImage(cmzn_field_cast_image(id));
566 }
567 
568 } // namespace Zinc
569 }
570 #endif
int setTextureCoordinateHeight(double height)
Definition: fieldimage.hpp:322
Field getDomainField()
Definition: fieldimage.hpp:436
int write(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:229
int read(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:224
HardwareCompressionMode getHardwareCompressionMode()
Definition: fieldimage.hpp:460
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:46
double getTextureCoordinateHeight()
Definition: fieldimage.hpp:273
double getTextureCoordinateWidth()
Definition: fieldimage.hpp:263
int setTextureCoordinateDepth(double depth)
Definition: fieldimage.hpp:334
WrapMode getWrapMode()
Definition: fieldimage.hpp:509
FieldImage castImage()
Definition: fieldimage.hpp:563
int setHardwareCompressionMode(HardwareCompressionMode hardwareCompressionMode)
Definition: fieldimage.hpp:474
int setTextureCoordinateSizes(int valuesCount, const double *valuesIn)
Definition: fieldimage.hpp:348
FieldImage createFieldImageFromSource(const Field &sourceField)
Definition: fieldimage.hpp:557
char * getProperty(const char *property)
Definition: fieldimage.hpp:536
FieldImage createFieldImage()
Definition: fieldimage.hpp:551
cmzn_field_id getId() const
Definition: field.hpp:98
int getWidthInPixels()
Definition: fieldimage.hpp:218
An image-based field giving the pixel colour/intensity values.
Definition: fieldimage.hpp:31
Definition: fieldimage.hpp:196
int setCombineMode(CombineMode combineMode)
Definition: fieldimage.hpp:423
HardwareCompressionMode
Definition: fieldimage.hpp:176
int setDomainField(const Field &domainField)
Definition: fieldimage.hpp:450
int setFilterMode(FilterMode filterMode)
Definition: fieldimage.hpp:498
int getDepthInPixels()
Definition: fieldimage.hpp:238
CombineMode
Definition: fieldimage.hpp:63
FilterMode
Definition: fieldimage.hpp:144
An image-specific stream information object.
Definition: streamimage.hpp:30
int getHeightInPixels()
Definition: fieldimage.hpp:228
int setWrapMode(WrapMode wrapMode)
Definition: fieldimage.hpp:521
int readFile(const char *fileName)
Definition: fieldimage.hpp:380
StreaminformationImage createStreaminformationImage()
Definition: streamimage.hpp:217
int setTextureCoordinateWidth(double width)
Definition: fieldimage.hpp:310
int getSizeInPixels(int valuesCount, int *valuesOut)
Definition: fieldimage.hpp:253
int getTextureCoordinateSizes(int valuesCount, double *valuesOut)
Definition: fieldimage.hpp:297
Definition: fieldimage.hpp:198
CombineMode getCombineMode()
Definition: fieldimage.hpp:411
double getTextureCoordinateDepth()
Definition: fieldimage.hpp:283
WrapMode
Definition: fieldimage.hpp:192
FilterMode getFilterMode()
Definition: fieldimage.hpp:485