Commit 30162ab3 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Add a helper to return the rgb to grayscale scaling factors.

parent f63d59d6
...@@ -52,6 +52,12 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) ...@@ -52,6 +52,12 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2)
return TRUE; return TRUE;
} }
PSRGB rgb_to_grayscale_scale( void )
{
static const PSRGB scale = {0.3, 0.59, 0.11};
/* FIXME configurable */
return scale;
}
/********************************************************************** /**********************************************************************
* PSDRV_CreateColor * PSDRV_CreateColor
...@@ -79,9 +85,9 @@ void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor, COLORREF wincolor ) ...@@ -79,9 +85,9 @@ void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor, COLORREF wincolor )
pscolor->value.rgb.g = g; pscolor->value.rgb.g = g;
pscolor->value.rgb.b = b; pscolor->value.rgb.b = b;
} else { } else {
PSRGB scale = rgb_to_grayscale_scale();
pscolor->type = PSCOLOR_GRAY; pscolor->type = PSCOLOR_GRAY;
/* FIXME configurable */ pscolor->value.gray.i = r * scale.r + g * scale.g + b * scale.b;
pscolor->value.gray.i = r * 0.3 + g * 0.59 + b * 0.11;
} }
return; return;
} }
......
...@@ -485,6 +485,7 @@ extern void PSDRV_ResetClip( PHYSDEV dev ) DECLSPEC_HIDDEN; ...@@ -485,6 +485,7 @@ extern void PSDRV_ResetClip( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN; extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) DECLSPEC_HIDDEN;
extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor, extern void PSDRV_CreateColor( PHYSDEV dev, PSCOLOR *pscolor,
COLORREF wincolor ) DECLSPEC_HIDDEN; COLORREF wincolor ) DECLSPEC_HIDDEN;
extern PSRGB rgb_to_grayscale_scale( void ) DECLSPEC_HIDDEN;
extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN; extern char PSDRV_UnicodeToANSI(int u) DECLSPEC_HIDDEN;
extern INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) DECLSPEC_HIDDEN; extern INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment