1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salbmp.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
36 #include <vcl/salgtype.hxx>
38 #include <saldisp.hxx>
39 #include <vcl/salbmp.hxx>
40 #include <vcl/dllapi.h>
46 class ImplSalBitmapCache
;
52 class VCL_DLLPUBLIC X11SalBitmap
: public SalBitmap
56 static BitmapBuffer
* ImplCreateDIB( const Size
& rSize
,
58 const BitmapPalette
& rPal
);
59 static BitmapBuffer
* ImplCreateDIB( Drawable aDrawable
,
63 long nWidth
, long nHeight
,
68 static ImplSalBitmapCache
* mpCache
;
69 static ULONG mnCacheInstCount
;
71 static void ImplCreateCache();
72 static void ImplDestroyCache();
73 void ImplRemovedFromCache();
75 bool SnapShot (Display
* pDisplay
, XLIB_Window hWindow
);
76 bool ImplCreateFromXImage( Display
* pDisplay
,
89 SAL_DLLPRIVATE
bool ImplCreateFromDrawable( Drawable aDrawable
,
93 long nWidth
, long nHeight
);
95 SAL_DLLPRIVATE XImage
* ImplCreateXImage( SalDisplay
* pSalDisp
,
96 int nScreen
, long nDepth
,
97 const SalTwoRect
& rTwoRect
) const;
99 SAL_DLLPRIVATE ImplSalDDB
* ImplGetDDB( Drawable
, int nScreen
, long nDrawableDepth
,
100 const SalTwoRect
& ) const;
101 void ImplDraw( Drawable aDrawable
, int nScreen
, long nDrawableDepth
,
102 const SalTwoRect
& rTwoRect
, const GC
& rGC
) const;
107 virtual ~X11SalBitmap();
109 // overload pure virtual methods
110 virtual bool Create( const Size
& rSize
,
112 const BitmapPalette
& rPal
);
113 virtual bool Create( const SalBitmap
& rSalBmp
);
114 virtual bool Create( const SalBitmap
& rSalBmp
,
115 SalGraphics
* pGraphics
);
116 virtual bool Create( const SalBitmap
& rSalBmp
,
117 USHORT nNewBitCount
);
118 virtual bool Create( const ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapCanvas
> xBitmapCanvas
,
120 bool bMask
= false );
122 virtual void Destroy();
124 virtual Size
GetSize() const;
125 virtual USHORT
GetBitCount() const;
127 virtual BitmapBuffer
* AcquireBuffer( bool bReadOnly
);
128 virtual void ReleaseBuffer( BitmapBuffer
* pBuffer
, bool bReadOnly
);
129 virtual bool GetSystemData( BitmapSystemData
& rData
);
141 SalTwoRect maTwoRect
;
147 static void ImplDraw( Drawable aSrcDrawable
, long nSrcDrawableDepth
,
148 Drawable aDstDrawable
, long nDstDrawableDepth
,
149 long nSrcX
, long nSrcY
,
150 long nDestWidth
, long nDestHeight
,
151 long nDestX
, long nDestY
, const GC
& rGC
);
155 ImplSalDDB( XImage
* pImage
,
156 Drawable aDrawable
, int nScreen
,
157 const SalTwoRect
& rTwoRect
);
158 ImplSalDDB( Drawable aDrawable
,
161 long nX
, long nY
, long nWidth
, long nHeight
);
162 ImplSalDDB( Display
* pDisplay
,
168 Pixmap
ImplGetPixmap() const { return maPixmap
; }
169 long ImplGetWidth() const { return maTwoRect
.mnDestWidth
; }
170 long ImplGetHeight() const { return maTwoRect
.mnDestHeight
; }
171 long ImplGetDepth() const { return mnDepth
; }
172 ULONG
ImplGetMemSize() const { return( ( maTwoRect
.mnDestWidth
* maTwoRect
.mnDestHeight
* mnDepth
) >> 3 ); }
173 int ImplGetScreen() const { return mnScreen
; }
175 bool ImplMatches( int nScreen
, long nDepth
, const SalTwoRect
& rTwoRect
) const;
176 void ImplDraw( Drawable aDrawable
, long nDrawableDepth
,
177 const SalTwoRect
& rTwoRect
, const GC
& rGC
) const;
180 // ----------------------
181 // - ImplSalBitmapCache -
182 // ----------------------
184 class ImplSalBitmapCache
193 ImplSalBitmapCache();
194 ~ImplSalBitmapCache();
196 void ImplAdd( X11SalBitmap
* pBmp
, ULONG nMemSize
= 0UL, ULONG nFlags
= 0UL );
197 void ImplRemove( X11SalBitmap
* pBmp
);
201 #endif // _SV_SALBMP_HXX