@JonB, after asking the question above, I have been trying to go the manual encoding route, with no real success.
What I have is an identity SKWarpGeometryGrid created with gridWithColumns_rows_. It reports the correct number of rows, cols and vertices, and self-identifies as an identity grid where the source and destination grids point to the same grid.
Now I try to change the destination grid with gridByReplacingDestPositions_. This requires vector_float2 and returns a new grid with the destination positions replaced.
These are the destination points I would like to try:
dest = [
(0.0, -0.5), (0.5, 0.0), (1.0, 0.0),
(0.0, 0.5), (0.5, 0.5), (1.0, 0.5),
(0.0, 1.0), (0.5, 1.0), (1.0, 1.0),
]
(Only the second float of the first tuple is changed from the identity grid.)
I have this manual definition:
f = self.geometry.gridByReplacingDestPositions_
f.argtypes = [c_void_p]
f.restype = c_void_p
f.encoding = b'@@:@'
And these for creating the destination argument from the array above:
class float2(Structure):
_fields_ = [('x',c_float),('y',c_float)]
@classmethod
def _get_float2(cls, positions):
floats = []
for pos in positions:
f = float2()
f.x, f.y = pos
floats.append(f)
floats_array = (float2 * len(floats))(*floats)
return floats_array
The method gets called and returns an updated SKWarpGeometryGrid, which unfortunately is still the same identity warp. This leads me to believe that my float2 is probably wrong and gets implicitly rejected without error.
I have also tried gridWithColumns_rows_sourcePositions_destPositions_, with same identity grid result.
Any next steps to try would be greatly appreciated.