1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Color picker module - Screen pixel reading functionality
//!
//! Provides the ability to read pixel colors from screen or window device contexts.
//! This module depends on Windows GDI API for capturing pixel data.
//!
//! # Features
//! - Read pixel colors from device context (HDC)
//! - Supports both window DC and desktop DC
//!
//! # Example
//! ```no_run
//! use win_auto_utils::hdc::get_window_client_dc;
//! use win_auto_utils::hwnd::get_hwnd_by_title;
//! use win_auto_utils::color_picker::get_pixel_color;
//!
//! if let Some(hwnd) = get_hwnd_by_title("Notepad") {
//! if let Ok(hdc) = get_window_client_dc(hwnd) {
//! if let Some(color) = get_pixel_color(hdc, 100, 100) {
//! println!("Pixel color at (100, 100): 0x{:06X}", color);
//! }
//! }
//! }
//! ```
use ;
/// Get pixel color from device context at specified coordinates
///
/// Reads the color value of a pixel at the given (x, y) position from the device context.
/// The returned value is in Windows COLORREF format (0x00BBGGRR).
///
/// # Arguments
/// * `hdc` - Device context handle to read from
/// * `x` - X coordinate (horizontal position)
/// * `y` - Y coordinate (vertical position)
///
/// # Returns
/// * `Some(u32)` - The pixel color in BGR format (0x00BBGGRR) if successful
/// * `None` - If the pixel cannot be read (e.g., coordinates out of bounds)