bump product version to 4.1.6.2
[LibreOffice.git] / vcl / source / filter / igif / gifread.hxx
blobe80e62187978aa046b9a1d598a9dafc8e666f878
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _GIFREAD_HXX
21 #define _GIFREAD_HXX
23 #include <vcl/graph.hxx>
24 #include <vcl/bmpacc.hxx>
26 #ifdef _GIFPRIVATE
28 enum GIFAction
30 GLOBAL_HEADER_READING,
31 MARKER_READING,
32 EXTENSION_READING,
33 LOCAL_HEADER_READING,
34 FIRST_BLOCK_READING,
35 NEXT_BLOCK_READING,
36 ABORT_READING,
37 END_READING
40 enum ReadState
42 GIFREAD_OK,
43 GIFREAD_ERROR,
44 GIFREAD_NEED_MORE
47 class GIFLZWDecompressor;
49 class SvStream;
51 class GIFReader : public GraphicReader
53 Graphic aImGraphic;
54 Animation aAnimation;
55 Bitmap aBmp8;
56 Bitmap aBmp1;
57 BitmapPalette aGPalette;
58 BitmapPalette aLPalette;
59 SvStream& rIStm;
60 HPBYTE pSrcBuf;
61 GIFLZWDecompressor* pDecomp;
62 BitmapWriteAccess* pAcc8;
63 BitmapWriteAccess* pAcc1;
64 long nYAcc;
65 long nLastPos;
66 sal_uInt32 nLogWidth100;
67 sal_uInt32 nLogHeight100;
68 sal_uInt16 nTimer;
69 sal_uInt16 nGlobalWidth; // maximale Bildbreite aus Header
70 sal_uInt16 nGlobalHeight; // maximale Bildhoehe aus Header
71 sal_uInt16 nImageWidth; // maximale Bildbreite aus Header
72 sal_uInt16 nImageHeight; // maximale Bildhoehe aus Header
73 sal_uInt16 nImagePosX;
74 sal_uInt16 nImagePosY;
75 sal_uInt16 nImageX; // maximale Bildbreite aus Header
76 sal_uInt16 nImageY; // maximale Bildhoehe aus Header
77 sal_uInt16 nLastImageY;
78 sal_uInt16 nLastInterCount;
79 sal_uInt16 nLoops;
80 GIFAction eActAction;
81 sal_Bool bStatus;
82 sal_Bool bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
83 sal_Bool bInterlaced;
84 sal_Bool bOverreadBlock;
85 sal_Bool bImGraphicReady;
86 sal_Bool bGlobalPalette;
87 sal_uInt8 nBackgroundColor; // Hintergrundfarbe
88 sal_uInt8 nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
89 sal_uInt8 nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
90 sal_uInt8 cTransIndex1;
91 sal_uInt8 cNonTransIndex1;
93 void ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount );
94 void ClearImageExtensions();
95 sal_Bool CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, sal_Bool bWatchForBackgroundColor );
96 sal_Bool ReadGlobalHeader();
97 sal_Bool ReadExtension();
98 sal_Bool ReadLocalHeader();
99 sal_uLong ReadNextBlock();
100 void FillImages( HPBYTE pBytes, sal_uLong nCount );
101 void CreateNewBitmaps();
102 sal_Bool ProcessGIF();
104 public:
106 ReadState ReadGIF( Graphic& rGraphic );
107 const Graphic& GetIntermediateGraphic();
109 GIFReader( SvStream& rStm );
110 virtual ~GIFReader();
113 #endif // _GIFPRIVATE
115 sal_Bool ImportGIF( SvStream& rStream, Graphic& rGraphic );
117 #endif // _GIFREAD_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */