#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxMakeFromValue (const HxImageSignature &signature, HxSizes sizes, HxValue val) |
| Make a new image with given signature and sizes. More... | |
|
||||||||||||||||
|
Make a new image with given signature and sizes. Pixel data is initialized with given value.
00014 {
00015 HxString fname("HxMakeFromValue");
00016
00017 if ((signature.pixelDimensionality() < 1) || (signature.pixelDimensionality() > 3))
00018 {
00019 HxGlobalError::instance()->reportError(fname, "Illegal pixel dimensionality", HxGlobalError::HX_GE_INVALID);
00020 return HxImageRep();
00021 }
00022 if ((signature.imageDimensionality() < 2) || (signature.imageDimensionality() > 3))
00023 {
00024 HxGlobalError::instance()->reportError(fname, "Illegal number of dimensions", HxGlobalError::HX_GE_INVALID);
00025 return HxImageRep();
00026 }
00027
00028 if (sizes.x() < 1)
00029 {
00030 HxGlobalError::instance()->reportError(fname, "Illegal x size", HxGlobalError::HX_GE_INVALID);
00031 return HxImageRep();
00032 }
00033 if (sizes.y() < 1)
00034 {
00035 HxGlobalError::instance()->reportError(fname, "Illegal y size", HxGlobalError::HX_GE_INVALID);
00036 return HxImageRep();
00037 }
00038 if (signature.imageDimensionality() > 2)
00039 {
00040 if (sizes.y() < 1)
00041 {
00042 HxGlobalError::instance()->reportError(fname, "Illegal y size", HxGlobalError::HX_GE_INVALID);
00043 return HxImageRep();
00044 }
00045 }
00046
00047 if ((val.tag() == HxValue::SI) || (val.tag() == HxValue::SD))
00048 {
00049 if (signature.pixelDimensionality() != 1)
00050 {
00051 HxGlobalError::instance()->reportError(fname, "value dimensionality does not correspond to signature", HxGlobalError::HX_GE_INVALID);
00052 return HxImageRep();
00053 }
00054 }
00055 else if ((val.tag() == HxValue::V2I) || (val.tag() == HxValue::V2D)
00056 || (val.tag() == HxValue::CPL))
00057 {
00058 if (signature.pixelDimensionality() != 2)
00059 {
00060 HxGlobalError::instance()->reportError(fname, "value dimensionality does not correspond to signature", HxGlobalError::HX_GE_INVALID);
00061 return HxImageRep();
00062 }
00063 }
00064 else if ((val.tag() == HxValue::V3I) || (val.tag() == HxValue::V3D))
00065 {
00066 if (signature.pixelDimensionality() != 3)
00067 {
00068 HxGlobalError::instance()->reportError(fname, "value dimensionality does not correspond to signature", HxGlobalError::HX_GE_INVALID);
00069 return HxImageRep();
00070 }
00071 }
00072
00073 return HxImageFactory::instance().fromValue(signature, sizes, val);
00074 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001