OpenCMISS-Zinc C++ API Documentation
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 "opencmiss/zinc/fieldimage.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/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 
252  int getSizeInPixels(int valuesCount, int *valuesOut)
253  {
254  return cmzn_field_image_get_size_in_pixels(getDerivedId(), valuesCount, valuesOut);
255  }
256 
270  int setSizeInPixels(int valuesCount, const int *valuesIn)
271  {
272  return cmzn_field_image_set_size_in_pixels(getDerivedId(), valuesCount, valuesIn);
273  }
274 
281  {
282  return cmzn_field_image_get_texture_coordinate_width(getDerivedId());
283  }
284 
291  {
292  return cmzn_field_image_get_texture_coordinate_height(getDerivedId());
293  }
294 
301  {
302  return cmzn_field_image_get_texture_coordinate_depth(getDerivedId());
303  }
304 
314  int getTextureCoordinateSizes(int valuesCount, double *valuesOut)
315  {
316  return cmzn_field_image_get_texture_coordinate_sizes(getDerivedId(), valuesCount,
317  valuesOut);
318  }
319 
327  int setTextureCoordinateWidth(double width)
328  {
329  return cmzn_field_image_set_texture_coordinate_width(getDerivedId(), width);
330  }
331 
339  int setTextureCoordinateHeight(double height)
340  {
341  return cmzn_field_image_set_texture_coordinate_height(getDerivedId(), height);
342  }
343 
351  int setTextureCoordinateDepth(double depth)
352  {
353  return cmzn_field_image_set_texture_coordinate_depth(getDerivedId(), depth);
354  }
355 
365  int setTextureCoordinateSizes(int valuesCount, const double *valuesIn)
366  {
367  return cmzn_field_image_set_texture_coordinate_sizes(getDerivedId(),
368  valuesCount, valuesIn);
369  }
370 
386  inline int read(const StreaminformationImage& streaminformationImage);
387 
397  int readFile(const char *fileName)
398  {
399  return cmzn_field_image_read_file(getDerivedId(), fileName);
400  }
401 
421  inline int write(const StreaminformationImage& streaminformationImage);
422 
429  {
430  return static_cast<CombineMode>(cmzn_field_image_get_combine_mode(getDerivedId()));
431  }
432 
440  int setCombineMode(CombineMode combineMode)
441  {
442  return cmzn_field_image_set_combine_mode(getDerivedId(),
443  static_cast<cmzn_field_image_combine_mode>(combineMode));
444  }
445 
454  {
455  return Field(cmzn_field_image_get_domain_field(getDerivedId()));
456  }
457 
467  int setDomainField(const Field& domainField)
468  {
469  return cmzn_field_image_set_domain_field(getDerivedId(), domainField.getId());
470  }
471 
478  {
479  return static_cast<HardwareCompressionMode>(
480  cmzn_field_image_get_hardware_compression_mode(getDerivedId()));
481  }
482 
492  {
493  return cmzn_field_image_set_hardware_compression_mode(getDerivedId(),
494  static_cast<cmzn_field_image_hardware_compression_mode>(hardwareCompressionMode));
495  }
496 
503  {
504  return static_cast<FilterMode>(cmzn_field_image_get_filter_mode(getDerivedId()));
505  }
506 
515  int setFilterMode(FilterMode filterMode)
516  {
517  return cmzn_field_image_set_filter_mode(getDerivedId(),
518  static_cast<cmzn_field_image_filter_mode>(filterMode));
519  }
520 
527  {
528  return static_cast<WrapMode>(cmzn_field_image_get_wrap_mode(getDerivedId()));
529  }
530 
538  int setWrapMode(WrapMode wrapMode)
539  {
540  return cmzn_field_image_set_wrap_mode(getDerivedId(),
541  static_cast<cmzn_field_image_wrap_mode>(wrapMode));
542  }
543 
553  char *getProperty(const char* property)
554  {
555  return cmzn_field_image_get_property(getDerivedId(), property);
556  }
557 
565 
566 };
567 
569 {
570  return FieldImage(reinterpret_cast<cmzn_field_image_id>(
571  cmzn_fieldmodule_create_field_image(id)));
572 }
573 
575 {
576  return FieldImage(reinterpret_cast<cmzn_field_image_id>(
577  cmzn_fieldmodule_create_field_image_from_source(id, sourceField.getId())));
578 }
579 
581 {
582  return FieldImage(cmzn_field_cast_image(id));
583 }
584 
585 } // namespace Zinc
586 }
587 #endif
int setTextureCoordinateHeight(double height)
Definition: fieldimage.hpp:339
Field getDomainField()
Definition: fieldimage.hpp:453
int write(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:228
int read(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:223
HardwareCompressionMode getHardwareCompressionMode()
Definition: fieldimage.hpp:477
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
double getTextureCoordinateHeight()
Definition: fieldimage.hpp:290
double getTextureCoordinateWidth()
Definition: fieldimage.hpp:280
int setTextureCoordinateDepth(double depth)
Definition: fieldimage.hpp:351
WrapMode getWrapMode()
Definition: fieldimage.hpp:526
FieldImage castImage()
Definition: fieldimage.hpp:580
int setHardwareCompressionMode(HardwareCompressionMode hardwareCompressionMode)
Definition: fieldimage.hpp:491
int setTextureCoordinateSizes(int valuesCount, const double *valuesIn)
Definition: fieldimage.hpp:365
FieldImage createFieldImageFromSource(const Field &sourceField)
Definition: fieldimage.hpp:574
char * getProperty(const char *property)
Definition: fieldimage.hpp:553
FieldImage createFieldImage()
Definition: fieldimage.hpp:568
cmzn_field_id getId() const
Definition: field.hpp:103
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:440
HardwareCompressionMode
Definition: fieldimage.hpp:176
int setDomainField(const Field &domainField)
Definition: fieldimage.hpp:467
int setFilterMode(FilterMode filterMode)
Definition: fieldimage.hpp:515
int getDepthInPixels()
Definition: fieldimage.hpp:238
int setSizeInPixels(int valuesCount, const int *valuesIn)
Definition: fieldimage.hpp:270
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:538
int readFile(const char *fileName)
Definition: fieldimage.hpp:397
StreaminformationImage createStreaminformationImage()
Definition: streamimage.hpp:216
The OpenCMISS namespace.
Definition: context.hpp:20
int setTextureCoordinateWidth(double width)
Definition: fieldimage.hpp:327
int getSizeInPixels(int valuesCount, int *valuesOut)
Definition: fieldimage.hpp:252
int getTextureCoordinateSizes(int valuesCount, double *valuesOut)
Definition: fieldimage.hpp:314
Definition: fieldimage.hpp:198
CombineMode getCombineMode()
Definition: fieldimage.hpp:428
double getTextureCoordinateDepth()
Definition: fieldimage.hpp:300
WrapMode
Definition: fieldimage.hpp:192
FilterMode getFilterMode()
Definition: fieldimage.hpp:502