xref: /AOO41X/main/svtools/inc/svtools/fltdefs.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
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 #include <tools/solar.h>
25 #include <vcl/bitmap.hxx>
26 
27 #include <string.h>
28 
29 #ifndef _FLTDEFS_HXX
30 #define _FLTDEFS_HXX
31 
32 
33 #if defined ( WNT )
34 
35 #define RGBQUAD RGBQUADWIN
36 
37 typedef struct RGBQUAD
38 {
39     sal_uInt8   rgbBlue;
40     sal_uInt8   rgbGreen;
41     sal_uInt8   rgbRed;
42     sal_uInt8   rgbReserved;
43 
RGBQUADRGBQUAD44             RGBQUAD( const sal_uInt8 cRed = 0, const sal_uInt8 cGreen = 0, const sal_uInt8 cBlue = 0 ) :
45                 rgbBlue     ( cBlue ),
46                 rgbGreen    ( cGreen ),
47                 rgbRed      ( cRed ),
48                 rgbReserved ( 0 ) {};
49 } RGBQUAD;
50 
51 
52 typedef sal_uInt8* PDIBBYTE;
53 #define MEMCPY memcpy
54 #define MEMSET memset
55 #define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalAlloc(GMEM_FIXED,(nSize)))
56 #define GLOBALFREE(pPointer) (GlobalFree((HGLOBAL)pPointer))
57 #define GLOBALHANDLE(pPointer) ((HGLOBAL)(pPointer))
58 
59 #else
60 
61 typedef sal_uInt8* PDIBBYTE;
62 #define MEMCPY memcpy
63 #define MEMSET memset
64 #define GLOBALALLOC(nSize) ((PDIBBYTE)new sal_uInt8[(nSize)])
65 #define GLOBALFREE(pPointer) (delete[] (pPointer))
66 
67 #endif
68 
69 
70 #if defined ( OS2 ) || defined ( UNX )
71 void ReadBitmap( SvStream& rIStream, Bitmap& rBmp, sal_uInt16 nDefaultHeight = 0, sal_uLong nOffBits = 0 );
72 void ReplaceInfoHeader( SvStream& rStm, sal_uInt8* pBuffer );
73 
74 #ifdef OS2
75 #define RGBQUAD             RGBQUADOS2
76 #define BITMAPFILEHEADER    BITMAPFILEHEADEROS2
77 #define PBITMAPFILEHEADER   PBITMAPFILEHEADEROS2
78 #define BITMAPINFOHEADER    BITMAPINFOHEADEROS2
79 #define PBITMAPINFOHEADER   PBITMAPINFOHEADEROS2
80 #define BITMAPINFO          BITMAPINFOOS2
81 #define PBITMAPINFO         PBITMAPINFOOS2
82 #endif
83 
84 typedef struct RGBQUAD
85 {
86     sal_uInt8   rgbBlue;
87     sal_uInt8   rgbGreen;
88     sal_uInt8   rgbRed;
89     sal_uInt8   rgbReserved;
90 
RGBQUADRGBQUAD91             RGBQUAD( const sal_uInt8 cRed = 0, const sal_uInt8 cGreen = 0, const sal_uInt8 cBlue = 0 ) :
92                 rgbBlue     ( cBlue ),
93                 rgbGreen    ( cGreen ),
94                 rgbRed      ( cRed ),
95                 rgbReserved ( 0 ) {};
96 } RGBQUAD;
97 
98 typedef struct BITMAPFILEHEADER
99 {
100     sal_uInt16  bfType;
101     sal_uInt32  bfSize;
102     sal_uInt16  bfReserved1;
103     sal_uInt16  bfReserved2;
104     sal_uInt32  bfOffBits;
105 } BITMAPFILEHEADER;
106 typedef BITMAPFILEHEADER* PBITMAPFILEHEADER;
107 
108 typedef struct BITMAPINFOHEADER
109 {
110     sal_uInt32  biSize;
111     sal_uInt32  biWidth;
112     sal_uInt32  biHeight;
113     sal_uInt16  biPlanes;
114     sal_uInt16  biBitCount;
115     sal_uInt32  biCompression;
116     sal_uInt32  biSizeImage;
117     sal_uInt32  biXPelsPerMeter;
118     sal_uInt32  biYPelsPerMeter;
119     sal_uInt32  biClrUsed;
120     sal_uInt32  biClrImportant;
121 } BITMAPINFOHEADER;
122 typedef BITMAPINFOHEADER* PBITMAPINFOHEADER;
123 
124 typedef struct BITMAPINFO
125 {
126     BITMAPINFOHEADER    bmiHeader;
127     RGBQUAD             bmiColors[1];
128 } BITMAPINFO;
129 typedef BITMAPINFO* PBITMAPINFO;
130 
131 #endif
132 #endif
133