From aa74eba4d4cd66d4674c45e04ca83c00b49c8778 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 14 Nov 2002 11:25:45 +0000 Subject: #i4337# set grayscale colors on non color devices --- psprint/source/printergfx/common_gfx.cxx | 33 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'psprint') diff --git a/psprint/source/printergfx/common_gfx.cxx b/psprint/source/printergfx/common_gfx.cxx index c973e2b1f717..e37cad17cc87 100644 --- a/psprint/source/printergfx/common_gfx.cxx +++ b/psprint/source/printergfx/common_gfx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: common_gfx.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: pl $ $Date: 2002-11-13 20:15:45 $ + * last change: $Author: pl $ $Date: 2002-11-14 12:25:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,7 @@ #endif #include +#include using namespace psp ; @@ -620,15 +621,25 @@ PrinterGfx::PSSetColor () char pBuffer[128]; sal_Int32 nChar = 0; - nChar = psp::getValueOfDouble (pBuffer, - (double)rColor.GetRed() / 255.0, 5); - nChar += psp::appendStr (" ", pBuffer + nChar); - nChar += psp::getValueOfDouble (pBuffer + nChar, - (double)rColor.GetGreen() / 255.0, 5); - nChar += psp::appendStr (" ", pBuffer + nChar); - nChar += psp::getValueOfDouble (pBuffer + nChar, - (double)rColor.GetBlue() / 255.0, 5); - nChar += psp::appendStr (" setrgbcolor\n", pBuffer + nChar ); + if( mbColor ) + { + nChar = psp::getValueOfDouble (pBuffer, + (double)rColor.GetRed() / 255.0, 5); + nChar += psp::appendStr (" ", pBuffer + nChar); + nChar += psp::getValueOfDouble (pBuffer + nChar, + (double)rColor.GetGreen() / 255.0, 5); + nChar += psp::appendStr (" ", pBuffer + nChar); + nChar += psp::getValueOfDouble (pBuffer + nChar, + (double)rColor.GetBlue() / 255.0, 5); + nChar += psp::appendStr (" setrgbcolor\n", pBuffer + nChar ); + } + else + { + Color aColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); + sal_uInt8 nCol = aColor.GetLuminance(); + nChar = psp::getValueOfDouble( pBuffer, (double)nCol / 255.0, 5 ); + nChar += psp::appendStr( " setgray\n", pBuffer + nChar ); + } WritePS (mpPageBody, pBuffer, nChar); } -- cgit