10d63794cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 30d63794cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 40d63794cSAndrew Rist * or more contributor license agreements. See the NOTICE file 50d63794cSAndrew Rist * distributed with this work for additional information 60d63794cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 70d63794cSAndrew Rist * to you under the Apache License, Version 2.0 (the 80d63794cSAndrew Rist * "License"); you may not use this file except in compliance 90d63794cSAndrew Rist * with the License. You may obtain a copy of the License at 100d63794cSAndrew Rist * 110d63794cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 120d63794cSAndrew Rist * 130d63794cSAndrew Rist * Unless required by applicable law or agreed to in writing, 140d63794cSAndrew Rist * software distributed under the License is distributed on an 150d63794cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 160d63794cSAndrew Rist * KIND, either express or implied. See the License for the 170d63794cSAndrew Rist * specific language governing permissions and limitations 180d63794cSAndrew Rist * under the License. 190d63794cSAndrew Rist * 200d63794cSAndrew Rist *************************************************************/ 210d63794cSAndrew Rist 220d63794cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_VIRDEV_HXX 25cdf0e10cSrcweir #define _SV_VIRDEV_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/sv.h> 28cdf0e10cSrcweir #include <vcl/dllapi.h> 29cdf0e10cSrcweir #include <vcl/outdev.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir // ----------------- 32cdf0e10cSrcweir // - VirtualDevice - 33cdf0e10cSrcweir // ----------------- 34cdf0e10cSrcweir 35cdf0e10cSrcweir class SalVirtualDevice; 36cdf0e10cSrcweir class RmVirtualDevice; 37cdf0e10cSrcweir struct SystemGraphicsData; 38cdf0e10cSrcweir 39cdf0e10cSrcweir class VCL_DLLPUBLIC VirtualDevice : public OutputDevice 40cdf0e10cSrcweir { 41cdf0e10cSrcweir friend class Application; 42cdf0e10cSrcweir friend class OutputDevice; 43cdf0e10cSrcweir 44cdf0e10cSrcweir private: 45cdf0e10cSrcweir SalVirtualDevice* mpVirDev; 46cdf0e10cSrcweir VirtualDevice* mpPrev; 47cdf0e10cSrcweir VirtualDevice* mpNext; 48cdf0e10cSrcweir sal_uInt16 mnBitCount; 49cdf0e10cSrcweir sal_Bool mbScreenComp; 50cdf0e10cSrcweir sal_Int8 mnAlphaDepth; 51cdf0e10cSrcweir sal_uInt8 meRefDevMode; 52cdf0e10cSrcweir 53cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ); 54cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir // Copy assignment is forbidden and not implemented. 57cdf0e10cSrcweir VirtualDevice (const VirtualDevice &); 58cdf0e10cSrcweir VirtualDevice & operator= (const VirtualDevice &); 59cdf0e10cSrcweir 60cdf0e10cSrcweir /** Used for alpha VDev, to set areas to opaque 61cdf0e10cSrcweir 62cdf0e10cSrcweir @since #i32109# 63cdf0e10cSrcweir */ 64cdf0e10cSrcweir SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const Rectangle& rRect ); 65cdf0e10cSrcweir 66cdf0e10cSrcweir // TODO: add extra member for refdev backward compatibility options 67cdf0e10cSrcweir #define REFDEV_FORCE_ZERO_EXTLEAD 0x80 ForceZeroExtleadBug() const68cdf0e10cSrcweir SAL_DLLPRIVATE bool ForceZeroExtleadBug() const 69cdf0e10cSrcweir { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); } 70cdf0e10cSrcweir public: 71*e1beba7dSHerbert Dürr explicit VirtualDevice( sal_uInt16 nBitCount = 0 ); 72*e1beba7dSHerbert Dürr explicit VirtualDevice( const OutputDevice& rCompDev, 73cdf0e10cSrcweir sal_uInt16 nBitCount = 0 ); 74cdf0e10cSrcweir /** Create a virtual device with alpha channel 75cdf0e10cSrcweir 76cdf0e10cSrcweir @param rCompDev 77cdf0e10cSrcweir The generated vdev will be compatible to this device. By 78cdf0e10cSrcweir default, Application::GetDefaultDevice() is used here. 79cdf0e10cSrcweir 80cdf0e10cSrcweir @param nBitCount 81cdf0e10cSrcweir Bit depth of the generated virtual device. Use 0 here, to 82cdf0e10cSrcweir indicate: take default screen depth. Currently, only 0 and 1 83cdf0e10cSrcweir are allowed here, with 1 denoting binary mask. 84cdf0e10cSrcweir 85cdf0e10cSrcweir @param nAlphaBitCount 86cdf0e10cSrcweir Bit depth of the generated virtual device. Use 0 here, to 87cdf0e10cSrcweir indicate: take default screen depth. Currently, only 0 and 1 88cdf0e10cSrcweir are allowed here, with 1 denoting binary mask. 89cdf0e10cSrcweir */ 90cdf0e10cSrcweir VirtualDevice( const OutputDevice& rCompDev, 91cdf0e10cSrcweir sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir /** Create a virtual device using an existing system dependent device or graphics context 94cdf0e10cSrcweir Any rendering will happen directly on the context and not on any intermediate bitmap. 95cdf0e10cSrcweir Note: This might not be suported on all platforms ! 96cdf0e10cSrcweir */ 97*e1beba7dSHerbert Dürr explicit VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual ~VirtualDevice(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir sal_Bool SetOutputSizePixel( const Size& rNewSize, sal_Bool bErase = sal_True ); SetOutputSize(const Size & rNewSize,sal_Bool bErase=sal_True)102cdf0e10cSrcweir sal_Bool SetOutputSize( const Size& rNewSize, sal_Bool bErase = sal_True ) 103cdf0e10cSrcweir { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } 104cdf0e10cSrcweir 105cdf0e10cSrcweir // reference device modes for different compatibility levels 106cdf0e10cSrcweir enum RefDevMode { REFDEV_NONE = 0, 107cdf0e10cSrcweir REFDEV_MODE06 = 1, // 600 dpi 108cdf0e10cSrcweir REFDEV_MODE48 = 2, // 4800 dpi 109cdf0e10cSrcweir REFDEV_MODE_MSO1 = 3, 110cdf0e10cSrcweir REFDEV_MODE_PDF1 = 4, 111cdf0e10cSrcweir REFDEV_CUSTOM = 5 112cdf0e10cSrcweir }; 113cdf0e10cSrcweir 114cdf0e10cSrcweir void SetReferenceDevice( RefDevMode ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir void Compat_ZeroExtleadBug(); // enable workaround for #i60495# 117cdf0e10cSrcweir 118cdf0e10cSrcweir void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir private: 121cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir }; 124cdf0e10cSrcweir 125cdf0e10cSrcweir #endif // _SV_VIRDEV_HXX 126*e1beba7dSHerbert Dürr 127