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: svimbase.hxx,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 ************************************************************************/
34 #include <vcl/bitmap.hxx>
35 #include <vcl/salbtype.hxx>
71 // ------------------------------------------------------------------------
73 inline BOOL
operator==( const SimColor
& rCol1
, const SimColor
& rCol2
)
75 return ( ( rCol1
.cRed
== rCol2
.cRed
) &&
76 ( rCol1
.cGreen
== rCol2
.cGreen
) &&
77 ( rCol1
.cBlue
== rCol2
.cBlue
) );
87 SimColor aColorArray
[ 256 ];
120 ULONG nAlignedWidth1
;
121 ULONG nAlignedWidth2
;
122 ULONG nAlignedWidth3
;
123 ULONG nAlignedWidth4
;
125 SimDepthType eOrgDepth
;
126 SimDepthType eUndoDepth
;
127 SimDepthType eRedoDepth
;
134 HPBYTE
BitmapToArray24( const Bitmap
& rBitmap
, ULONG
* pWidth
,
135 ULONG
* pHeight
, ULONG
* pAlignedWidth
,
136 SfxViewFrame
*pFrame
= NULL
);
137 BOOL
Array24ToBitmap( HPBYTE pArray
, Bitmap
&rBitmap
,
138 const ULONG nWidth
, const ULONG nHeight
,
139 const ULONG nColorCount
= 256,
140 ULONG nLast
= 0, SfxProgress
* pProgress
= NULL
);
142 Bitmap
CreateSaveBitmap( const SimDepthType eDepth
, SfxViewFrame
*pFrame
= NULL
);
144 HPBYTE
CreateArray24( ULONG nWidth
, ULONG nHeight
);
145 void DeleteArray( HPBYTE pArray
);
147 SvImageBase(const SvImageBase
& rSvImageBase
);
148 const SvImageBase
& operator=(const SvImageBase
& rSvImageBase
);
153 SvImageBase( const Bitmap
& rBitmap
,
154 const ULONG nColorCount
= 256,
155 ULONG nLast
= 0, SfxProgress
* pProgress
= NULL
);
158 BOOL
IsValid() { return bValid
; }
160 ULONG
GetOrgWidth() const { return nWhichOrg
== 1 ? nWidth1
: nWidth2
; }
161 ULONG
GetDestWidth() const { return nWhichOrg
== 1 ? nWidth2
: nWidth1
; }
163 ULONG
GetOrgHeight() const { return nWhichOrg
== 1 ? nHeight1
: nHeight2
; }
164 ULONG
GetDestHeight() const { return nWhichOrg
== 1 ? nHeight2
: nHeight1
; }
166 ULONG
GetOrgAlignedWidth() const { return nWhichOrg
== 1 ? nAlignedWidth1
: nAlignedWidth2
; }
167 ULONG
GetDestAlignedWidth() const { return nWhichOrg
== 1 ? nAlignedWidth2
: nAlignedWidth1
; }
169 ULONG
GetOrgAlignedSize() const { return GetOrgAlignedWidth() * GetOrgHeight(); }
170 ULONG
GetDestAlignedSize() const { return GetDestAlignedWidth() * GetDestHeight(); }
172 // Farbtiefe des Ausgangsbildes ermitteln und setzen
173 SimDepthType
GetDepth() const { return eOrgDepth
; }
174 void SetDepth( const SimDepthType eDepth
) { eOrgDepth
= eDepth
; }
176 // Farbtiefen nach Undo und Redo ermitteln und setzen
177 SimDepthType
GetUndoDepth() const { return eUndoDepth
; }
178 void SetUndoDepth(const SimDepthType eDepth
) { eUndoDepth
= eDepth
; }
180 SimDepthType
GetRedoDepth() const { return eRedoDepth
; }
181 void SetRedoDepth(const SimDepthType eDepth
) { eRedoDepth
= eDepth
; }
183 // Vor- und Ruecklauf der Bildverarbeitung
184 BOOL
BeginProcessing( BOOL bUndo
= TRUE
);
185 void EndProcessing();
187 BOOL
BeginProcessingExt(ULONG nWidth
, ULONG nHeight
, BOOL bUndo
= TRUE
);
188 void EndProcessingExt() { EndProcessing(); }
190 // Zeiger auf Arrays zur Verfuegung stellen
191 HPBYTE
GetOrgPointer() { return pOrgArray
; }
192 HPBYTE
GetDestPointer() { return pDestArray
; }
194 // DIB-Erzeugung fuer Anzeige
195 BOOL
CreateOutBitmap( const ULONG nColorCount
= 256, ULONG nLast
= 0,
196 SfxProgress
* pProgress
= NULL
);
199 BOOL
DoUndo( SfxProgress
* pProgress
= NULL
);
200 BOOL
DoRedo( SfxProgress
* pProgress
= NULL
);
202 // DIB-Rueckgabe fuer Anzeige
203 const Bitmap
& GetOutBitmap() const;
205 // DIB-Rueckgabe fuer Speicherung
206 Bitmap
GetSaveBitmap();
209 SimPalette
* GetOrgPalette() const { return nWhichOrg
== 1 ? pPal1
: pPal2
; }
210 SimPalette
* GetDestPalette() const { return nWhichOrg
== 1 ? pPal2
: pPal1
; }
217 BOOL
DitherBitmap( Bitmap
& rBitmap
, BOOL bDitherAlways
= FALSE
);
219 #endif // _SVIMBASE_HXX