- Improved efficiency and readability of the RfbBitmap configuration logic. Refactored redundant code blocks for different pixel format (bpp) configurations into a single, streamlined method. This change enhances maintainability and clarity of the bitmap configuration process.
- Added cursor pseudo encoding support. - Added Windows support for cursor image capturing in `get_cursor_image` method. Implemented Windows-specific logic using the `win32gui`, `win32ui`, and related libraries to capture the current cursor image, enhancing the cross-platform capability of the application. - Fixed issues in `get_bitmap` method for handling different bpp formats. Specifically addressed the processing logic for 16 bpp (BGR565) format, ensuring that the image conversion and rendering are handled correctly for VNC clients expecting this format. - Added initial Tight encoding support. - Updated the `send_image` method in the Tight encoding class to correctly handle JPEG and ZLIB compression. This includes proper signaling to the client about the type of compression used (JPEG or ZLIB) and ensuring that the data is formatted and sent according to the Tight encoding specifications. - Added checks and conversions in `send_image` to handle different image modes (like RGBX and RGBA) and convert them to the appropriate format (RGB) before compression and transmission. - Implemented a more robust and accurate method for determining when to use JPEG compression in Tight encoding based on the unique color count and image characteristics. These updates significantly improve the functionality, stability, and compatibility of the VNC server, particularly in handling different pixel formats and encoding methods.
This commit is contained in:
@@ -2,14 +2,11 @@ import sys
|
||||
from PIL import Image
|
||||
from lib import log
|
||||
|
||||
if sys.platform == "linux" or sys.platform == "linux2":
|
||||
log.debug("ImageGrab: running on Linux")
|
||||
from Xlib import display, X
|
||||
# take screen images, that's not the best way, so here
|
||||
# we use directly use xlib to take the screenshot.
|
||||
class ImageGrab():
|
||||
@staticmethod
|
||||
def grab():
|
||||
class ImageGrab():
|
||||
@staticmethod
|
||||
def grab():
|
||||
if sys.platform == "linux" or sys.platform == "linux2":
|
||||
from Xlib import display, X
|
||||
dsp = display.Display()
|
||||
root = dsp.screen().root
|
||||
geom = root.get_geometry()
|
||||
@@ -19,12 +16,8 @@ if sys.platform == "linux" or sys.platform == "linux2":
|
||||
image = Image.frombytes("RGB", (w, h), raw.data, "raw", "BGRX")
|
||||
return image
|
||||
|
||||
elif sys.platform == "darwin":
|
||||
log.debug("ImageGrab: running on darwin")
|
||||
import Quartz.CoreGraphics as CG
|
||||
class ImageGrab():
|
||||
@staticmethod
|
||||
def grab():
|
||||
elif sys.platform == "darwin":
|
||||
import Quartz.CoreGraphics as CG
|
||||
screenshot = CG.CGWindowListCreateImage(CG.CGRectInfinite, CG.kCGWindowListOptionOnScreenOnly, CG.kCGNullWindowID, CG.kCGWindowImageDefault)
|
||||
width = CG.CGImageGetWidth(screenshot)
|
||||
height = CG.CGImageGetHeight(screenshot)
|
||||
@@ -38,6 +31,10 @@ elif sys.platform == "darwin":
|
||||
|
||||
return i
|
||||
|
||||
else:
|
||||
log.debug("ImageGrab: running on Unknown!")
|
||||
from PIL import ImageGrab
|
||||
elif sys.platform == "win32":
|
||||
from PIL import ImageGrab as WinImageGrab
|
||||
return WinImageGrab.grab()
|
||||
|
||||
else:
|
||||
log.debug("ImageGrab: running on an unknown platform!")
|
||||
raise EnvironmentError("Unsupported platform")
|
||||
|
||||
Reference in New Issue
Block a user