

def testAreaFormat(self):
    constant = GafferImage.Constant()
    constant['format'].setValue(GafferImage.Format(1024, 576))
    crop1 = GafferImage.Crop()
    crop1['in'].setInput(constant['out'])
    crop1['areaSource'].setValue(GafferImage.Crop.AreaSource.Format)
    crop1['format'].setValue(GafferImage.Format(2048, 1152))
    crop2 = GafferImage.Crop()
    crop2['in'].setInput(constant['out'])
    crop2['areaSource'].setValue(GafferImage.Crop.AreaSource.Area)
    crop2['area'].setValue(IECore.Box2i(IECore.V2i(0, 0), IECore.V2i(2048, 1152)))
    self.assertEqual(crop1['out']['dataWindow'].getValue(), crop2['out']['dataWindow'].getValue())
    crop1['formatCenter'].setValue(True)
    crop2['area'].setValue(IECore.Box2i(IECore.V2i((- 512), (- 288)), IECore.V2i(1536, 864)))
    crop2['resetOrigin'].setValue(True)
    self.assertEqual(crop1['out']['dataWindow'].getValue(), crop2['out']['dataWindow'].getValue())

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferImageTest/CropTest.py CropTest.testAreaFormat/original