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