def parseBitmapEvent(self, fastPathBitmapEvent: FastPathOutputEvent) -> FastPathBitmapEvent: rawBitmapUpdateData = fastPathBitmapEvent.payload stream = BytesIO(rawBitmapUpdateData) updateType = Uint16LE.unpack(stream.read(2)) bitmapData = self.bitmapParser.parseBitmapUpdateData(stream.read()) return FastPathBitmapEvent(fastPathBitmapEvent.header, fastPathBitmapEvent.compressionFlags, bitmapData, rawBitmapUpdateData)
def handleBitmap(self, pdu: PlayerBitmapPDU): bpp = 32 flags = 0 # RDP expects bitmap data in bottom-up, left-to-right # See: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/84a3d4d2-5523-4e49-9a48-33952c559485 for y in range(pdu.height): pixels = pdu.pixels[y * pdu.width * 4 : (y + 1) * pdu.width * 4] bitmap = BitmapUpdateData(0, y, pdu.width, y + 1, pdu.width, 1, bpp, flags, pixels) bitmapData = BitmapParser().writeBitmapUpdateData([bitmap]) event = FastPathBitmapEvent(FastPathOutputType.FASTPATH_UPDATETYPE_BITMAP, None, [], bitmapData) self.sendOutputEvents([event])
def parseBitmapEventRaw(self, stream: BytesIO, header: int, compressionFlags: int, size: int) -> FastPathBitmapEvent: return FastPathBitmapEvent(header, compressionFlags, [], stream.read(size))
def parseBitmapEventRaw(self, stream, header, compressionFlags, size): return FastPathBitmapEvent(header, compressionFlags, [], stream.read(size))