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

This commit is contained in:
Huw Davies 2013-04-05 11:59:06 +01:00 committed by Alexandre Julliard
parent f63d59d640
commit 30162ab39d
2 changed files with 9 additions and 2 deletions

View File

@ -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 )
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;
} }

View File

@ -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;