sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / gifread.hxx
blobc180407f8968befb15ea3555ec1e4bf7ac3d9adb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gifread.hxx,v $
10 * $Revision: 1.3 $
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 ************************************************************************/
31 #ifndef _GIFREAD_HXX
32 #define _GIFREAD_HXX
34 #ifndef _GRAPH_HXX
35 #include <vcl/graph.hxx>
36 #endif
37 #ifndef _BMPACC_HXX
38 #include <vcl/bmpacc.hxx>
39 #endif
41 class SvStream;
43 namespace binfilter
46 #ifdef _GIFPRIVATE
48 // ---------
49 // - Enums -
50 // ---------
52 enum GIFAction
54 GLOBAL_HEADER_READING,
55 MARKER_READING,
56 EXTENSION_READING,
57 LOCAL_HEADER_READING,
58 FIRST_BLOCK_READING,
59 NEXT_BLOCK_READING,
60 ABORT_READING,
61 END_READING
64 // ------------------------------------------------------------------------
66 enum ReadState
68 GIFREAD_OK,
69 GIFREAD_ERROR,
70 GIFREAD_NEED_MORE
73 // -------------
74 // - GIFReader -
75 // -------------
77 class GIFLZWDecompressor;
79 class GIFReader : public GraphicReader
81 Graphic aImGraphic;
82 Animation aAnimation;
83 Bitmap aBmp8;
84 Bitmap aBmp1;
85 BitmapPalette aGPalette;
86 BitmapPalette aLPalette;
87 SvStream& rIStm;
88 void* pCallerData;
89 HPBYTE pSrcBuf;
90 GIFLZWDecompressor* pDecomp;
91 BitmapWriteAccess* pAcc8;
92 BitmapWriteAccess* pAcc1;
93 long nYAcc;
94 long nLastPos;
95 sal_uInt32 nLogWidth100;
96 sal_uInt32 nLogHeight100;
97 USHORT nTimer;
98 USHORT nGlobalWidth; // maximale Bildbreite aus Header
99 USHORT nGlobalHeight; // maximale Bildhoehe aus Header
100 USHORT nImageWidth; // maximale Bildbreite aus Header
101 USHORT nImageHeight; // maximale Bildhoehe aus Header
102 USHORT nImagePosX;
103 USHORT nImagePosY;
104 USHORT nImageX; // maximale Bildbreite aus Header
105 USHORT nImageY; // maximale Bildhoehe aus Header
106 USHORT nLastImageY;
107 USHORT nLastInterCount;
108 USHORT nLoops;
109 GIFAction eActAction;
110 BOOL bStatus;
111 BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
112 BOOL bInterlaced;
113 BOOL bOverreadBlock;
114 BOOL bImGraphicReady;
115 BOOL bGlobalPalette;
116 BYTE nBackgroundColor; // Hintergrundfarbe
117 BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
118 BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
119 BYTE cTransIndex1;
120 BYTE cNonTransIndex1;
122 void ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount );
123 void ClearImageExtensions();
124 BOOL CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, BOOL bWatchForBackgroundColor );
125 BOOL ReadGlobalHeader();
126 BOOL ReadExtension();
127 BOOL ReadLocalHeader();
128 ULONG ReadNextBlock();
129 void FillImages( HPBYTE pBytes, ULONG nCount );
130 void CreateNewBitmaps();
131 BOOL ProcessGIF();
133 public:
135 ReadState ReadGIF( Graphic& rGraphic );
136 const Graphic& GetIntermediateGraphic();
138 GIFReader( SvStream& rStm );
139 virtual ~GIFReader();
142 #endif // _GIFPRIVATE
144 // -------------
145 // - ImportGIF -
146 // -------------
148 BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic );
152 #endif // _GIFREAD_HXX