MCPcopy Create free account
hub / github.com/ImageEngine/cortex / ImageCropOp

Method ImageCropOp

src/IECoreImage/ImageCropOp.cpp:61–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59IE_CORE_DEFINERUNTIMETYPED( ImageCropOp );
60
61ImageCropOp::ImageCropOp()
62 : ModifyOp(
63 "Performs cropping over ImagePrimitive objects.\n"
64 "The operation results on an ImagePrimitive with displayWindow equal to the intersection of the given crop box and the original image displayWindow.\n"
65 "If matchDataWindow if On then the dataWindow will match the new displayWindow (new pixels will be filled with zero). Otherwise it will only be intersected against the given crop box.",
66 new ImagePrimitiveParameter( "result", "The result", new ImagePrimitive() ),
67 new ImagePrimitiveParameter( "input", "The image to modify", new ImagePrimitive() )
68 )
69{
70 m_cropBoxParameter = new Box2iParameter(
71 "cropBox",
72 "Determines the crop coordinates to apply on the image.",
73 Box2i()
74 );
75
76 parameters()->addParameter( m_cropBoxParameter );
77
78 m_matchDataWindowParameter = new BoolParameter(
79 "matchDataWindow",
80 "if On then the dataWindow will match displayWindow. Otherwise it will be intersected against the given crop box.",
81
82 /// \todo The original intent was that this default should be false, but when specifying "new BoolData(false)" as
83 /// the default value it seems the compiler would prefer to convert the BoolData* to a bool over a BoolData::Ptr.
84 /// Consider changing the default if required, but only on the next major version change.
85 true
86 );
87
88 parameters()->addParameter( m_matchDataWindowParameter );
89
90 m_resetOriginParameter = new BoolParameter(
91 "resetOrigin",
92 "if On then the resulting image will have it's top-left corner at (0,0).",
93 true
94 );
95
96 parameters()->addParameter( m_resetOriginParameter );
97
98 m_intersectParameter = new BoolParameter(
99 "intersect",
100 "If enabled then the display window of the resultant image will be cropped against the crop reigion too",
101 true
102 );
103
104 parameters()->addParameter( m_intersectParameter );
105
106
107 /// \todo Add "reformat" parameter, like Nuke
108 /// Current behaviour is to reformat, so take care to set the default accordingly.
109}
110
111ImageCropOp::~ImageCropOp()
112{

Callers 3

__testCropMethod · 0.80
testDefaultsMethod · 0.80
testEmptyCropBoxMethod · 0.80

Calls 1

addParameterMethod · 0.45

Tested by 3

__testCropMethod · 0.64
testDefaultsMethod · 0.64
testEmptyCropBoxMethod · 0.64