Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _JPEG_HXX
21 : #define _JPEG_HXX
22 :
23 : #include <vcl/graph.hxx>
24 : #include <svtools/fltcall.hxx>
25 : #include <com/sun/star/uno/Sequence.h>
26 : #include <com/sun/star/beans/PropertyValue.hpp>
27 : #include <com/sun/star/task/XStatusIndicator.hpp>
28 :
29 : #ifdef _JPEGPRIVATE
30 :
31 : // --------
32 : // - Enum -
33 : // --------
34 :
35 : enum ReadState
36 : {
37 : JPEGREAD_OK,
38 : JPEGREAD_ERROR,
39 : JPEGREAD_NEED_MORE
40 : };
41 :
42 : // --------------
43 : // - JPEGReader -
44 : // --------------
45 :
46 : class JPEGReader : public GraphicReader
47 : {
48 : SvStream& rIStm;
49 : Bitmap aBmp;
50 : Bitmap aBmp1;
51 : BitmapWriteAccess* pAcc;
52 : BitmapWriteAccess* pAcc1;
53 : void* pBuffer;
54 : long nLastPos;
55 : long nFormerPos;
56 : long nLastLines;
57 : sal_Bool bSetLogSize;
58 :
59 : Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines );
60 : void FillBitmap();
61 :
62 : public:
63 :
64 : void* CreateBitmap( void* JPEGCreateBitmapParam );
65 :
66 : public:
67 :
68 :
69 :
70 : JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLogSize );
71 : virtual ~JPEGReader();
72 :
73 :
74 : ReadState Read( Graphic& rGraphic );
75 : };
76 :
77 : // --------------
78 : // - JPEGWriter -
79 : // --------------
80 :
81 : class JPEGWriter
82 : {
83 : SvStream& rOStm;
84 : Bitmap aBmp;
85 : BitmapReadAccess* pAcc;
86 : sal_uInt8* pBuffer;
87 : sal_Bool bNative;
88 :
89 : sal_Bool bGreys;
90 : sal_Int32 nQuality;
91 :
92 : bool* pExpWasGrey;
93 :
94 : com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
95 :
96 : public:
97 :
98 : void* GetScanline( long nY );
99 :
100 : JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
101 : bool* pExportWasGrey = NULL );
102 0 : ~JPEGWriter() {};
103 :
104 : sal_Bool Write( const Graphic& rGraphic );
105 : };
106 :
107 : #endif // _JPEGPRIVATE
108 :
109 : // ---------------------
110 : // - Import/ExportJPEG -
111 : // ---------------------
112 :
113 : sal_Bool ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
114 :
115 : sal_Bool ExportJPEG( SvStream& rStream,
116 : const Graphic& rGraphic,
117 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData,
118 : bool* pExportWasGrey = NULL
119 : );
120 :
121 : #endif // _JPEG_HXX
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|