update dev300-m58
[ooovba.git] / svtools / inc / gifread.hxx
blob41a8aef7a23403ec9276ab97464b4624328d2b4d
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.6 $
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 #ifdef _GIFPRIVATE
43 // ---------
44 // - Enums -
45 // ---------
47 enum GIFAction
49 GLOBAL_HEADER_READING,
50 MARKER_READING,
51 EXTENSION_READING,
52 LOCAL_HEADER_READING,
53 FIRST_BLOCK_READING,
54 NEXT_BLOCK_READING,
55 ABORT_READING,
56 END_READING
59 // ------------------------------------------------------------------------
61 enum ReadState
63 GIFREAD_OK,
64 GIFREAD_ERROR,
65 GIFREAD_NEED_MORE
68 // -------------
69 // - GIFReader -
70 // -------------
72 class GIFLZWDecompressor;
74 class SvStream;
76 class GIFReader : public GraphicReader
78 Graphic aImGraphic;
79 Animation aAnimation;
80 Bitmap aBmp8;
81 Bitmap aBmp1;
82 BitmapPalette aGPalette;
83 BitmapPalette aLPalette;
84 SvStream& rIStm;
85 void* pCallerData;
86 HPBYTE pSrcBuf;
87 GIFLZWDecompressor* pDecomp;
88 BitmapWriteAccess* pAcc8;
89 BitmapWriteAccess* pAcc1;
90 long nYAcc;
91 long nLastPos;
92 sal_uInt32 nLogWidth100;
93 sal_uInt32 nLogHeight100;
94 USHORT nTimer;
95 USHORT nGlobalWidth; // maximale Bildbreite aus Header
96 USHORT nGlobalHeight; // maximale Bildhoehe aus Header
97 USHORT nImageWidth; // maximale Bildbreite aus Header
98 USHORT nImageHeight; // maximale Bildhoehe aus Header
99 USHORT nImagePosX;
100 USHORT nImagePosY;
101 USHORT nImageX; // maximale Bildbreite aus Header
102 USHORT nImageY; // maximale Bildhoehe aus Header
103 USHORT nLastImageY;
104 USHORT nLastInterCount;
105 USHORT nLoops;
106 GIFAction eActAction;
107 BOOL bStatus;
108 BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
109 BOOL bInterlaced;
110 BOOL bOverreadBlock;
111 BOOL bImGraphicReady;
112 BOOL bGlobalPalette;
113 BYTE nBackgroundColor; // Hintergrundfarbe
114 BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
115 BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
116 BYTE cTransIndex1;
117 BYTE cNonTransIndex1;
119 void ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount );
120 void ClearImageExtensions();
121 BOOL CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, BOOL bWatchForBackgroundColor );
122 BOOL ReadGlobalHeader();
123 BOOL ReadExtension();
124 BOOL ReadLocalHeader();
125 ULONG ReadNextBlock();
126 void FillImages( HPBYTE pBytes, ULONG nCount );
127 void CreateNewBitmaps();
128 BOOL ProcessGIF();
130 public:
132 ReadState ReadGIF( Graphic& rGraphic );
133 const Graphic& GetIntermediateGraphic();
135 GIFReader( SvStream& rStm );
136 virtual ~GIFReader();
139 #endif // _GIFPRIVATE
141 // -------------
142 // - ImportGIF -
143 // -------------
145 BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic );
147 #endif // _GIFREAD_HXX