simple-rdp 0.8.2__cp314-cp314-win_amd64.whl → 0.8.4__cp314-cp314-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
simple_rdp/client.py CHANGED
@@ -409,6 +409,22 @@ class RDPClient:
409
409
  """
410
410
  return await self._display.screenshot()
411
411
 
412
+ async def pointer_area_screenshot(self) -> tuple[Image.Image, tuple[int, int], tuple[int, int]]:
413
+ """
414
+ Capture a cropped area around the pointer position.
415
+
416
+ The crop is 1/3 width x 1/3 height of the display (1/9 of total area),
417
+ centered on the pointer position when possible. When the pointer is
418
+ near edges, the crop is clamped to stay within display bounds.
419
+
420
+ Returns:
421
+ Tuple of (cropped_image, (top_x, top_y), (bottom_x, bottom_y)) where:
422
+ - cropped_image: Cropped region with pointer composited
423
+ - (top_x, top_y): Top-left corner position of crop relative to display
424
+ - (bottom_x, bottom_y): Bottom-right corner position of crop relative to display
425
+ """
426
+ return await self._display.pointer_area_screenshot()
427
+
412
428
  async def save_screenshot(self, path: str) -> None:
413
429
  """
414
430
  Save a screenshot to a file.
simple_rdp/display.py CHANGED
@@ -528,6 +528,53 @@ class Display:
528
528
  img.save(path)
529
529
  logger.info(f"Screenshot saved to {path}")
530
530
 
531
+ async def pointer_area_screenshot(self) -> tuple[Image.Image, tuple[int, int], tuple[int, int]]:
532
+ """
533
+ Capture a cropped area around the pointer position.
534
+
535
+ The crop is 1/3 width x 1/3 height of the display (1/9 of total area),
536
+ centered on the pointer position when possible. When the pointer is
537
+ near edges, the crop is clamped to stay within display bounds.
538
+
539
+ Returns:
540
+ Tuple of (cropped_image, (top_x, top_y), (bottom_x, bottom_y)) where:
541
+ - cropped_image: Cropped region with pointer composited
542
+ - (top_x, top_y): Top-left corner position of crop relative to display
543
+ - (bottom_x, bottom_y): Bottom-right corner position of crop relative to display
544
+ """
545
+ async with self._screen_lock:
546
+ if self._raw_display_image is None:
547
+ crop_w = self._width // 3
548
+ crop_h = self._height // 3
549
+ return (Image.new("RGB", (crop_w, crop_h), (0, 0, 0)), (0, 0), (crop_w, crop_h))
550
+
551
+ # Update final display image if dirty
552
+ if self._final_display_image_dirty or self._final_display_image is None:
553
+ self._update_final_display_image()
554
+
555
+ assert self._final_display_image is not None
556
+
557
+ # Calculate crop dimensions (1/3 of display)
558
+ crop_w = self._width // 3
559
+ crop_h = self._height // 3
560
+
561
+ # Calculate ideal top-left to center pointer
562
+ top_x = self._pointer_x - crop_w // 2
563
+ top_y = self._pointer_y - crop_h // 2
564
+
565
+ # Clamp to display bounds
566
+ top_x = max(0, min(top_x, self._width - crop_w))
567
+ top_y = max(0, min(top_y, self._height - crop_h))
568
+
569
+ # Calculate bottom-right corner
570
+ bottom_x = top_x + crop_w
571
+ bottom_y = top_y + crop_h
572
+
573
+ # Crop the image
574
+ cropped = self._final_display_image.crop((top_x, top_y, bottom_x, bottom_y))
575
+
576
+ return (cropped.copy(), (top_x, top_y), (bottom_x, bottom_y))
577
+
531
578
  async def apply_bitmap(
532
579
  self,
533
580
  x: int,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple-rdp
3
- Version: 0.8.2
3
+ Version: 0.8.4
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -0,0 +1,14 @@
1
+ simple_rdp\__init__.py,sha256=zJw8lC4mIERiJQJb1ziRaS5pUNGNcE1z8xuGymxwwB8,717
2
+ simple_rdp\_rle.cp314-win_amd64.pyd,sha256=5_0njnQW9VpiICuyhZQ5rJbe8EZmod2UFlnUE7o8m2I,195072
3
+ simple_rdp\capabilities.py,sha256=jAP3SYjPORIDLV0p2tKD21jq3ulthd6NgpYVJ2uv1vg,17797
4
+ simple_rdp\client.py,sha256=Gk7xKCW4PQeVPKzCDoztnXEFFG9Fvw7ov30ZR7cgh1M,72559
5
+ simple_rdp\credssp.py,sha256=nf75WpBvL8X7i4nT5o27tmfPCwkLhAfamBzMlXnd5CE,16370
6
+ simple_rdp\display.py,sha256=tcABxCzxU3fB0IfN8OC5ULjoFEAsbcLzsXQyM5BF7aE,40050
7
+ simple_rdp\input.py,sha256=nnSEac9t4j72ZdCvhhDMcXGu9KwoqRCdzpyZxnUg_AE,938
8
+ simple_rdp\mcs.py,sha256=egSTKViZVXd0uaUBPorc9ia79xa0XwUgnTm3u5G2eXw,26462
9
+ simple_rdp\pdu.py,sha256=GRat4fJ56zhSvy0QtP5tBqpClDNTCH6CPp9FELrXTxw,18713
10
+ simple_rdp-0.8.4.dist-info\METADATA,sha256=q68U4Zvv6n7QqwYg_K64gFDZ4TVrIz_OS8uCWrapQS8,11619
11
+ simple_rdp-0.8.4.dist-info\WHEEL,sha256=TASrtxyeL-Pi7odwPBMCgR1YebCHdBFZvgqiADG_4b0,97
12
+ simple_rdp-0.8.4.dist-info\entry_points.txt,sha256=CPwBu2L4Vh3MZwYYlTAotNUElilT43OKdi3UnHTTKQ4,66
13
+ simple_rdp-0.8.4.dist-info\licenses\LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
14
+ simple_rdp-0.8.4.dist-info\RECORD,,
@@ -1,14 +0,0 @@
1
- simple_rdp\__init__.py,sha256=zJw8lC4mIERiJQJb1ziRaS5pUNGNcE1z8xuGymxwwB8,717
2
- simple_rdp\_rle.cp314-win_amd64.pyd,sha256=WFv4ja6VmOMmetlc7MG72AyOOe69z8Lha0zXy1qpY6s,195072
3
- simple_rdp\capabilities.py,sha256=jAP3SYjPORIDLV0p2tKD21jq3ulthd6NgpYVJ2uv1vg,17797
4
- simple_rdp\client.py,sha256=b5hkY9ToldqEDrtfY2muHhvFdOjBL_90kUE11aK_1ac,71725
5
- simple_rdp\credssp.py,sha256=nf75WpBvL8X7i4nT5o27tmfPCwkLhAfamBzMlXnd5CE,16370
6
- simple_rdp\display.py,sha256=rSG7cZI63Bq0ymrWaBs6Rhq5sb7qkaDBaYJ5DetAX5U,37963
7
- simple_rdp\input.py,sha256=nnSEac9t4j72ZdCvhhDMcXGu9KwoqRCdzpyZxnUg_AE,938
8
- simple_rdp\mcs.py,sha256=egSTKViZVXd0uaUBPorc9ia79xa0XwUgnTm3u5G2eXw,26462
9
- simple_rdp\pdu.py,sha256=GRat4fJ56zhSvy0QtP5tBqpClDNTCH6CPp9FELrXTxw,18713
10
- simple_rdp-0.8.2.dist-info\METADATA,sha256=tFUK52tbvNW4mDesgKXXXcGZ0-DsWxOx_TDHDwvGQcg,11619
11
- simple_rdp-0.8.2.dist-info\WHEEL,sha256=TASrtxyeL-Pi7odwPBMCgR1YebCHdBFZvgqiADG_4b0,97
12
- simple_rdp-0.8.2.dist-info\entry_points.txt,sha256=CPwBu2L4Vh3MZwYYlTAotNUElilT43OKdi3UnHTTKQ4,66
13
- simple_rdp-0.8.2.dist-info\licenses\LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
14
- simple_rdp-0.8.2.dist-info\RECORD,,