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

Method __makeFloatImage

test/IECoreImage/ImageWriterTest.py:79–113  ·  view source on GitHub ↗
( self, dataWindow, displayWindow, withAlpha = False, dataType = IECore.FloatVectorData )

Source from the content-addressed store, hash-verified

77 self.assertTrue( res.value )
78
79 def __makeFloatImage( self, dataWindow, displayWindow, withAlpha = False, dataType = IECore.FloatVectorData ) :
80
81 img = IECoreImage.ImagePrimitive( dataWindow, displayWindow )
82
83 w = dataWindow.max().x - dataWindow.min().x + 1
84 h = dataWindow.max().y - dataWindow.min().y + 1
85
86 area = w * h
87 R = dataType( area )
88 G = dataType( area )
89 B = dataType( area )
90
91 if withAlpha:
92 A = dataType( area )
93
94 offset = 0
95 for y in range( 0, h ) :
96 for x in range( 0, w ) :
97
98 R[offset] = float(x) / (w - 1)
99 G[offset] = float(y) / (h - 1)
100 B[offset] = 0.0
101 if withAlpha:
102 A[offset] = 0.5
103
104 offset = offset + 1
105
106 img["R"] = R
107 img["G"] = G
108 img["B"] = B
109
110 if withAlpha:
111 img["A"] = A
112
113 return img
114
115 def __makeIntImage( self, dataWindow, displayWindow, dataType = IECore.UIntVectorData, maxInt = 2**32-1 ) :
116

Callers 14

testCanWriteMethod · 0.95
testWriteMethod · 0.95
testWriteIncompleteMethod · 0.95
testWindowWriteMethod · 0.95
testBlindDataToHeaderMethod · 0.95
testJPGMethod · 0.95
testDPXMethod · 0.95
testTIFMethod · 0.95
testAlphaTIFMethod · 0.95

Calls 3

ImagePrimitiveMethod · 0.80
maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected