Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / source / filter / igif / gifread.hxx
blob5816fe54e6c20a231973f78da9357e93757dc880
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 INCLUDED_VCL_SOURCE_FILTER_IGIF_GIFREAD_HXX
21 #define INCLUDED_VCL_SOURCE_FILTER_IGIF_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; // maximum imagewidth from header
70 sal_uInt16 nGlobalHeight; // maximum imageheight from header
71 sal_uInt16 nImageWidth; // maximum screenwidth from header
72 sal_uInt16 nImageHeight; // maximum screenheight from header
73 sal_uInt16 nImagePosX;
74 sal_uInt16 nImagePosY;
75 sal_uInt16 nImageX; // maximum screenwidth from header
76 sal_uInt16 nImageY; // maximum screenheight from header
77 sal_uInt16 nLastImageY;
78 sal_uInt16 nLastInterCount;
79 sal_uInt16 nLoops;
80 GIFAction eActAction;
81 bool bStatus;
82 bool bGCTransparent; // is the image transparant, if yes:
83 bool bInterlaced;
84 bool bOverreadBlock;
85 bool bImGraphicReady;
86 bool bGlobalPalette;
87 sal_uInt8 nBackgroundColor; // backgroundcolour
88 sal_uInt8 nGCTransparentIndex; // pixelx of this index are transparant
89 sal_uInt8 nGCDisposalMethod; // 'Disposal Method' (see GIF docs)
90 sal_uInt8 cTransIndex1;
91 sal_uInt8 cNonTransIndex1;
93 void ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount );
94 void ClearImageExtensions();
95 bool CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, bool bWatchForBackgroundColor );
96 bool ReadGlobalHeader();
97 bool ReadExtension();
98 bool ReadLocalHeader();
99 sal_uLong ReadNextBlock();
100 void FillImages( HPBYTE pBytes, sal_uLong nCount );
101 void CreateNewBitmaps();
102 bool ProcessGIF();
104 public:
106 ReadState ReadGIF( Graphic& rGraphic );
107 const Graphic& GetIntermediateGraphic();
109 GIFReader( SvStream& rStm );
110 virtual ~GIFReader();
113 #endif // _GIFPRIVATE
115 bool ImportGIF( SvStream& rStream, Graphic& rGraphic );
117 #endif // INCLUDED_VCL_SOURCE_FILTER_IGIF_GIFREAD_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */