def fromBytes(self,data,index=0): """ decode a byte buffer :param data: data buffer to decode :param index: index within the buffer to start at """ io=IO(data,index,boolSize=32) print(io.data[0:50]) self.name=io.sz754 self.uniqueId=io.u32 self.visible=io.bool self.linked=io.bool numParasites=io.u32 numStrokes=io.u32 raise Exception('Parasites=%d Strokes=%d'%(numParasites,numStrokes)) for _ in range(numParasites): p=GimpParasite() io.index=p.fromBytes(io.data,io.index) self.parasites.append(p) for _ in range(numStrokes): gs=GimpStroke(self) io.index=gs.fromBytes(io.data,io.index) self.strokes.append(p) return io.index
def fromBytes(self,data:bytes,index:int=0): """ decode a byte buffer :param data: data buffer to decode :param index: index within the buffer to start at """ io=IO(data,index,boolSize=32) self.strokeType=io.u32 self.closedShape=io.bool self.numFloatsPerPoint=io.u32 self.numPoints=io.u32 for _ in range(self.numPoints): gp=GimpPoint(self) io.index=gp.fromBytes(io.data,io.index,self.numFloatsPerPoint) self.points.append(gp) return io.index