summaryrefslogtreecommitdiff
path: root/psprint
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2002-11-14 11:25:45 +0000
committerPhilipp Lohmann <pl@openoffice.org>2002-11-14 11:25:45 +0000
commitaa74eba4d4cd66d4674c45e04ca83c00b49c8778 (patch)
tree8d2c06b2cd46d0d0514d71e0fa27b3c3e4df8a33 /psprint
parenta5aa7ca344dcec9e3b94d600840c9ab5debc2ef9 (diff)
#i4337# set grayscale colors on non color devices
Diffstat (limited to 'psprint')
-rw-r--r--psprint/source/printergfx/common_gfx.cxx33
1 files changed, 22 insertions, 11 deletions
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 <tools/debug.hxx>
+#include <tools/color.hxx>
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);
}