mhammond / pywin32

Python for Windows (pywin32) Extensions
4.91k stars 783 forks source link

Feature Request: Add a Function for `GetDIBits()` #2120

Open songyuc opened 9 months ago

songyuc commented 9 months ago

Description

I would like to propose the addition of a function for the Windows API function GetDIBits. This function is crucial for obtaining detailed bitmap information and pixel data, and it offers more flexibility compared to GetBitmapBits().

Suggested Code Example

Here's how one might use the function in Python:

import win32gui
import win32api

hdc = win32gui.GetDC(0)
bmp = win32gui.CreateCompatibleBitmap(hdc, width, height)

# Hypothetical function
pixels = win32api.GetDIBits(hdc, bmp, start_scan, scan_lines)