19e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
39e0fc027SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
49e0fc027SAndrew Rist * or more contributor license agreements. See the NOTICE file
59e0fc027SAndrew Rist * distributed with this work for additional information
69e0fc027SAndrew Rist * regarding copyright ownership. The ASF licenses this file
79e0fc027SAndrew Rist * to you under the Apache License, Version 2.0 (the
89e0fc027SAndrew Rist * "License"); you may not use this file except in compliance
99e0fc027SAndrew Rist * with the License. You may obtain a copy of the License at
109e0fc027SAndrew Rist *
119e0fc027SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
129e0fc027SAndrew Rist *
139e0fc027SAndrew Rist * Unless required by applicable law or agreed to in writing,
149e0fc027SAndrew Rist * software distributed under the License is distributed on an
159e0fc027SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0fc027SAndrew Rist * KIND, either express or implied. See the License for the
179e0fc027SAndrew Rist * specific language governing permissions and limitations
189e0fc027SAndrew Rist * under the License.
199e0fc027SAndrew Rist *
209e0fc027SAndrew Rist *************************************************************/
219e0fc027SAndrew Rist
229e0fc027SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "rtl/alloc.h"
28cdf0e10cSrcweir #include <vcl/graph.hxx>
29cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
30cdf0e10cSrcweir #include <vcl/svapp.hxx>
31cdf0e10cSrcweir #include <svtools/fltcall.hxx>
32cdf0e10cSrcweir #include <svl/solar.hrc>
33cdf0e10cSrcweir #include <svtools/FilterConfigItem.hxx>
34cdf0e10cSrcweir
35cdf0e10cSrcweir //============================ PCDReader ==================================
36cdf0e10cSrcweir
37cdf0e10cSrcweir // Diese Aufloesungen sind in einer PCD-Datei enthalten:
38cdf0e10cSrcweir enum PCDResolution {
39cdf0e10cSrcweir PCDRES_BASE16, // 192 x 128
40cdf0e10cSrcweir PCDRES_BASE4, // 384 x 256
41cdf0e10cSrcweir PCDRES_BASE, // 768 x 512
42cdf0e10cSrcweir // Die folgenden sind komprimiert und koennen
43cdf0e10cSrcweir // von uns NICHT gelesen werden:
44cdf0e10cSrcweir PCDRES_4BASE, // 1536 x 1024
45cdf0e10cSrcweir PCDRES_16BASE // 3072 x 3072
46cdf0e10cSrcweir };
47cdf0e10cSrcweir
48cdf0e10cSrcweir class PCDReader {
49cdf0e10cSrcweir
50cdf0e10cSrcweir private:
51cdf0e10cSrcweir
52cdf0e10cSrcweir sal_Bool bStatus;
53cdf0e10cSrcweir
54cdf0e10cSrcweir sal_uLong nLastPercent;
55cdf0e10cSrcweir
56cdf0e10cSrcweir SvStream* pPCD;
57cdf0e10cSrcweir BitmapWriteAccess* mpAcc;
58cdf0e10cSrcweir
59cdf0e10cSrcweir sal_uInt8 nOrientation; // Ausrichtung des Bildes in der PCD-Datei:
60cdf0e10cSrcweir // 0 - Turmspitze zeigt nach oben
61cdf0e10cSrcweir // 1 - Turmspitze zeigt nach rechts
62cdf0e10cSrcweir // 2 - Turmspitze zeigt nach unten
63cdf0e10cSrcweir // 3 - Turmspitze zeigt nach links
64cdf0e10cSrcweir
65cdf0e10cSrcweir PCDResolution eResolution; // Welche Aufloesung wir haben wollen
66cdf0e10cSrcweir
67cdf0e10cSrcweir sal_uLong nWidth; // Breite des PCD-Bildes
68cdf0e10cSrcweir sal_uLong nHeight; // Hoehe des PCD-Bildes
69cdf0e10cSrcweir sal_uLong nImagePos; // Position des Bildes in der PCD-Datei
70cdf0e10cSrcweir
71cdf0e10cSrcweir // Temporare BLue-Green-Red-Bitmap
72cdf0e10cSrcweir sal_uLong nBMPWidth;
73cdf0e10cSrcweir sal_uLong nBMPHeight;
74cdf0e10cSrcweir
75cdf0e10cSrcweir void MayCallback(sal_uLong nPercent);
76cdf0e10cSrcweir
77cdf0e10cSrcweir void CheckPCDImagePacFile();
78cdf0e10cSrcweir // Prueft, ob es eine Photo-CD-Datei mit 'Image Pac' ist.
79cdf0e10cSrcweir
80cdf0e10cSrcweir void ReadOrientation();
81cdf0e10cSrcweir // Liest die Ausrichtung und setzt nOrientation
82cdf0e10cSrcweir
83cdf0e10cSrcweir void ReadImage(sal_uLong nMinPercent, sal_uLong nMaxPercent);
84cdf0e10cSrcweir
85cdf0e10cSrcweir public:
86cdf0e10cSrcweir
PCDReader()87cdf0e10cSrcweir PCDReader() {}
~PCDReader()88cdf0e10cSrcweir ~PCDReader() {}
89cdf0e10cSrcweir
90cdf0e10cSrcweir sal_Bool ReadPCD( SvStream & rPCD, Graphic & rGraphic, FilterConfigItem* pConfigItem );
91cdf0e10cSrcweir };
92cdf0e10cSrcweir
93cdf0e10cSrcweir //=================== Methoden von PCDReader ==============================
94cdf0e10cSrcweir
ReadPCD(SvStream & rPCD,Graphic & rGraphic,FilterConfigItem * pConfigItem)95cdf0e10cSrcweir sal_Bool PCDReader::ReadPCD( SvStream & rPCD, Graphic & rGraphic, FilterConfigItem* pConfigItem )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir Bitmap aBmp;
98cdf0e10cSrcweir
99cdf0e10cSrcweir bStatus = sal_True;
100cdf0e10cSrcweir nLastPercent = 0;
101cdf0e10cSrcweir pPCD = &rPCD;
102cdf0e10cSrcweir
103cdf0e10cSrcweir MayCallback( 0 );
104cdf0e10cSrcweir
105cdf0e10cSrcweir // Ist es eine PCD-Datei mit Bild ? ( setzt bStatus == sal_False, wenn nicht ):
106cdf0e10cSrcweir CheckPCDImagePacFile();
107cdf0e10cSrcweir
108cdf0e10cSrcweir // Orientierung des Bildes einlesen:
109cdf0e10cSrcweir ReadOrientation();
110cdf0e10cSrcweir
111cdf0e10cSrcweir // Welche Aufloesung wollen wir ?:
112cdf0e10cSrcweir eResolution = PCDRES_BASE;
113cdf0e10cSrcweir if ( pConfigItem )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir sal_Int32 nResolution = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), 2 );
116cdf0e10cSrcweir if ( nResolution == 1 )
117cdf0e10cSrcweir eResolution = PCDRES_BASE4;
118cdf0e10cSrcweir else if ( nResolution == 0 )
119cdf0e10cSrcweir eResolution = PCDRES_BASE16;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir // Groesse und Position (Position in PCD-Datei) des Bildes bestimmen:
122cdf0e10cSrcweir switch (eResolution)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir case PCDRES_BASE16 :
125cdf0e10cSrcweir nWidth = 192;
126cdf0e10cSrcweir nHeight = 128;
127cdf0e10cSrcweir nImagePos = 8192;
128cdf0e10cSrcweir break;
129cdf0e10cSrcweir
130cdf0e10cSrcweir case PCDRES_BASE4 :
131cdf0e10cSrcweir nWidth = 384;
132cdf0e10cSrcweir nHeight = 256;
133cdf0e10cSrcweir nImagePos = 47104;
134cdf0e10cSrcweir break;
135cdf0e10cSrcweir
136cdf0e10cSrcweir case PCDRES_BASE :
137cdf0e10cSrcweir nWidth = 768;
138cdf0e10cSrcweir nHeight = 512;
139cdf0e10cSrcweir nImagePos = 196608;
140cdf0e10cSrcweir break;
141cdf0e10cSrcweir
142cdf0e10cSrcweir default:
143cdf0e10cSrcweir bStatus = sal_False;
144cdf0e10cSrcweir }
145cdf0e10cSrcweir if ( bStatus )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir if ( ( nOrientation & 0x01 ) == 0 )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir nBMPWidth = nWidth;
150cdf0e10cSrcweir nBMPHeight = nHeight;
151cdf0e10cSrcweir }
152cdf0e10cSrcweir else
153cdf0e10cSrcweir {
154cdf0e10cSrcweir nBMPWidth = nHeight;
155cdf0e10cSrcweir nBMPHeight = nWidth;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir aBmp = Bitmap( Size( nBMPWidth, nBMPHeight ), 24 );
158*0af288bdSJuergen Schmidt mpAcc = aBmp.AcquireWriteAccess();
159*0af288bdSJuergen Schmidt if ( !mpAcc )
160cdf0e10cSrcweir return sal_False;
161cdf0e10cSrcweir
162cdf0e10cSrcweir ReadImage( 5 ,65 );
163cdf0e10cSrcweir
164cdf0e10cSrcweir aBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
165cdf0e10cSrcweir rGraphic = aBmp;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir return bStatus;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
170cdf0e10cSrcweir // -------------------------------------------------------------------------------------------
171cdf0e10cSrcweir
MayCallback(sal_uLong)172cdf0e10cSrcweir void PCDReader::MayCallback(sal_uLong /*nPercent*/)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir /*
175cdf0e10cSrcweir if ( nPercent >= nLastPercent + 3 )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir nLastPercent=nPercent;
178cdf0e10cSrcweir if ( pCallback != NULL && nPercent <= 100 && bStatus == sal_True )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir if ( ( (*pCallback)( pCallerData, (sal_uInt16)nPercent ) ) == sal_True )
181cdf0e10cSrcweir bStatus = sal_False;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir }
184cdf0e10cSrcweir */
185cdf0e10cSrcweir }
186cdf0e10cSrcweir
187cdf0e10cSrcweir // -------------------------------------------------------------------------------------------
188cdf0e10cSrcweir
CheckPCDImagePacFile()189cdf0e10cSrcweir void PCDReader::CheckPCDImagePacFile()
190cdf0e10cSrcweir {
191cdf0e10cSrcweir char Buf[ 8 ];
192cdf0e10cSrcweir
193cdf0e10cSrcweir pPCD->Seek( 2048 );
194cdf0e10cSrcweir pPCD->Read( Buf, 7 );
195cdf0e10cSrcweir Buf[ 7 ] = 0;
196cdf0e10cSrcweir if ( ByteString( Buf ).CompareTo( "PCD_IPI" ) != COMPARE_EQUAL )
197cdf0e10cSrcweir bStatus = sal_False;
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir // -------------------------------------------------------------------------------------------
201cdf0e10cSrcweir
ReadOrientation()202cdf0e10cSrcweir void PCDReader::ReadOrientation()
203cdf0e10cSrcweir {
204cdf0e10cSrcweir if ( bStatus == sal_False )
205cdf0e10cSrcweir return;
206cdf0e10cSrcweir pPCD->Seek( 194635 );
207cdf0e10cSrcweir *pPCD >> nOrientation;
208cdf0e10cSrcweir nOrientation &= 0x03;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir
211cdf0e10cSrcweir // -------------------------------------------------------------------------------------------
212cdf0e10cSrcweir
ReadImage(sal_uLong nMinPercent,sal_uLong nMaxPercent)213cdf0e10cSrcweir void PCDReader::ReadImage(sal_uLong nMinPercent, sal_uLong nMaxPercent)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir sal_uLong nx,ny,nW2,nH2,nYPair,ndy,nXPair;
216cdf0e10cSrcweir long nL,nCb,nCr,nRed,nGreen,nBlue;
217cdf0e10cSrcweir sal_uInt8 * pt;
218cdf0e10cSrcweir sal_uInt8 * pL0; // Luminanz fuer jeden Pixel der 1. Zeile des aktuellen Zeilen-Paars
219cdf0e10cSrcweir sal_uInt8 * pL1; // Luminanz fuer jeden Pixel der 2. Zeile des aktuellen Zeilen-Paars
220cdf0e10cSrcweir sal_uInt8 * pCb; // Blau-Chrominanz fuer je 2x2 Pixel des aktuellen Zeilen-Paars
221cdf0e10cSrcweir sal_uInt8 * pCr; // Rot-Chrominanz fuer je 2x2 Pixel des aktuellen Zeilen-Paars
222cdf0e10cSrcweir sal_uInt8 * pL0N, * pL1N, * pCbN, * pCrN; // wie oben, nur fuer das naechste Zeilen-Paar
223cdf0e10cSrcweir
224cdf0e10cSrcweir if ( bStatus == sal_False )
225cdf0e10cSrcweir return;
226cdf0e10cSrcweir
227cdf0e10cSrcweir nW2=nWidth>>1;
228cdf0e10cSrcweir nH2=nHeight>>1;
229cdf0e10cSrcweir
230cdf0e10cSrcweir pL0 =(sal_uInt8*)rtl_allocateMemory( nWidth );
231cdf0e10cSrcweir pL1 =(sal_uInt8*)rtl_allocateMemory( nWidth );
232cdf0e10cSrcweir pCb =(sal_uInt8*)rtl_allocateMemory( nW2+1 );
233cdf0e10cSrcweir pCr =(sal_uInt8*)rtl_allocateMemory( nW2+1 );
234cdf0e10cSrcweir pL0N=(sal_uInt8*)rtl_allocateMemory( nWidth );
235cdf0e10cSrcweir pL1N=(sal_uInt8*)rtl_allocateMemory( nWidth );
236cdf0e10cSrcweir pCbN=(sal_uInt8*)rtl_allocateMemory( nW2+1 );
237cdf0e10cSrcweir pCrN=(sal_uInt8*)rtl_allocateMemory( nW2+1 );
238cdf0e10cSrcweir
239cdf0e10cSrcweir if ( pL0 == NULL || pL1 == NULL || pCb == NULL || pCr == NULL ||
240cdf0e10cSrcweir pL0N == NULL || pL1N == NULL || pCbN == NULL || pCrN == NULL)
241cdf0e10cSrcweir {
242cdf0e10cSrcweir rtl_freeMemory((void*)pL0 );
243cdf0e10cSrcweir rtl_freeMemory((void*)pL1 );
244cdf0e10cSrcweir rtl_freeMemory((void*)pCb );
245cdf0e10cSrcweir rtl_freeMemory((void*)pCr );
246cdf0e10cSrcweir rtl_freeMemory((void*)pL0N);
247cdf0e10cSrcweir rtl_freeMemory((void*)pL1N);
248cdf0e10cSrcweir rtl_freeMemory((void*)pCbN);
249cdf0e10cSrcweir rtl_freeMemory((void*)pCrN);
250cdf0e10cSrcweir bStatus = sal_False;
251cdf0e10cSrcweir return;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir pPCD->Seek( nImagePos );
255cdf0e10cSrcweir
256cdf0e10cSrcweir // naechstes Zeilen-Paar := erstes Zeile-Paar:
257cdf0e10cSrcweir pPCD->Read( pL0N, nWidth );
258cdf0e10cSrcweir pPCD->Read( pL1N, nWidth );
259cdf0e10cSrcweir pPCD->Read( pCbN, nW2 );
260cdf0e10cSrcweir pPCD->Read( pCrN, nW2 );
261cdf0e10cSrcweir pCbN[ nW2 ] = pCbN[ nW2 - 1 ];
262cdf0e10cSrcweir pCrN[ nW2 ] = pCrN[ nW2 - 1 ];
263cdf0e10cSrcweir
264cdf0e10cSrcweir for ( nYPair = 0; nYPair < nH2; nYPair++ )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir // aktuelles Zeilen-Paar := naechstes Zeilen-Paar
267cdf0e10cSrcweir pt=pL0; pL0=pL0N; pL0N=pt;
268cdf0e10cSrcweir pt=pL1; pL1=pL1N; pL1N=pt;
269cdf0e10cSrcweir pt=pCb; pCb=pCbN; pCbN=pt;
270cdf0e10cSrcweir pt=pCr; pCr=pCrN; pCrN=pt;
271cdf0e10cSrcweir
272cdf0e10cSrcweir // naechstes Zeilen-Paar holen:
273cdf0e10cSrcweir if ( nYPair < nH2 - 1 )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir pPCD->Read( pL0N, nWidth );
276cdf0e10cSrcweir pPCD->Read( pL1N, nWidth );
277cdf0e10cSrcweir pPCD->Read( pCbN, nW2 );
278cdf0e10cSrcweir pPCD->Read( pCrN, nW2 );
279cdf0e10cSrcweir pCbN[nW2]=pCbN[ nW2 - 1 ];
280cdf0e10cSrcweir pCrN[nW2]=pCrN[ nW2 - 1 ];
281cdf0e10cSrcweir }
282cdf0e10cSrcweir else
283cdf0e10cSrcweir {
284cdf0e10cSrcweir for ( nXPair = 0; nXPair < nW2; nXPair++ )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir pCbN[ nXPair ] = pCb[ nXPair ];
287cdf0e10cSrcweir pCrN[ nXPair ] = pCr[ nXPair ];
288cdf0e10cSrcweir }
289cdf0e10cSrcweir }
290cdf0e10cSrcweir
291cdf0e10cSrcweir // Schleife uber die beiden Zeilen des Zeilen-Paars:
292cdf0e10cSrcweir for ( ndy = 0; ndy < 2; ndy++ )
293cdf0e10cSrcweir {
294cdf0e10cSrcweir ny = ( nYPair << 1 ) + ndy;
295cdf0e10cSrcweir
296cdf0e10cSrcweir // Schleife ueber X:
297cdf0e10cSrcweir for ( nx = 0; nx < nWidth; nx++ )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir // nL,nCb,nCr fuer den Pixel nx,ny holen/berechenen:
300cdf0e10cSrcweir nXPair = nx >> 1;
301cdf0e10cSrcweir if ( ndy == 0 )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir nL = (long)pL0[ nx ];
304cdf0e10cSrcweir if (( nx & 1 ) == 0 )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir nCb = (long)pCb[ nXPair ];
307cdf0e10cSrcweir nCr = (long)pCr[ nXPair ];
308cdf0e10cSrcweir }
309cdf0e10cSrcweir else
310cdf0e10cSrcweir {
311cdf0e10cSrcweir nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) ) >> 1;
312cdf0e10cSrcweir nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1 ] ) ) >> 1;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir else {
316cdf0e10cSrcweir nL = pL1[ nx ];
317cdf0e10cSrcweir if ( ( nx & 1 ) == 0 )
318cdf0e10cSrcweir {
319cdf0e10cSrcweir nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCbN[ nXPair ] ) ) >> 1;
320cdf0e10cSrcweir nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCrN[ nXPair ] ) ) >> 1;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir else
323cdf0e10cSrcweir {
324cdf0e10cSrcweir nCb = ( ( (long)pCb[ nXPair ] ) + ( (long)pCb[ nXPair + 1 ] ) +
325cdf0e10cSrcweir ( (long)pCbN[ nXPair ] ) + ( (long)pCbN[ nXPair + 1 ] ) ) >> 2;
326cdf0e10cSrcweir nCr = ( ( (long)pCr[ nXPair ] ) + ( (long)pCr[ nXPair + 1] ) +
327cdf0e10cSrcweir ( (long)pCrN[ nXPair ] ) + ( (long)pCrN[ nXPair + 1 ] ) ) >> 2;
328cdf0e10cSrcweir }
329cdf0e10cSrcweir }
330cdf0e10cSrcweir // Umwandlung von nL,nCb,nCr in nRed,nGreen,nBlue:
331cdf0e10cSrcweir nL *= 89024L;
332cdf0e10cSrcweir nCb -= 156;
333cdf0e10cSrcweir nCr -= 137;
334cdf0e10cSrcweir nRed = ( nL + nCr * 119374L + 0x8000 ) >> 16;
335cdf0e10cSrcweir if ( nRed < 0 )
336cdf0e10cSrcweir nRed = 0;
337cdf0e10cSrcweir if ( nRed > 255)
338cdf0e10cSrcweir nRed = 255;
339cdf0e10cSrcweir nGreen = ( nL - nCb * 28198L - nCr * 60761L + 0x8000 ) >> 16;
340cdf0e10cSrcweir if ( nGreen < 0 )
341cdf0e10cSrcweir nGreen = 0;
342cdf0e10cSrcweir if ( nGreen > 255 )
343cdf0e10cSrcweir nGreen = 255;
344cdf0e10cSrcweir nBlue = ( nL + nCb * 145352L + 0x8000 ) >> 16;
345cdf0e10cSrcweir if ( nBlue < 0 )
346cdf0e10cSrcweir nBlue = 0;
347cdf0e10cSrcweir if ( nBlue > 255 )
348cdf0e10cSrcweir nBlue = 255;
349cdf0e10cSrcweir
350cdf0e10cSrcweir // Farbwert in pBMPMap eintragen:
351cdf0e10cSrcweir if ( nOrientation < 2 )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir if ( nOrientation == 0 )
354cdf0e10cSrcweir mpAcc->SetPixel( ny, nx, BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) );
355cdf0e10cSrcweir else
356cdf0e10cSrcweir mpAcc->SetPixel( nWidth - 1 - nx, ny, BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) );
357cdf0e10cSrcweir }
358cdf0e10cSrcweir else
359cdf0e10cSrcweir {
360cdf0e10cSrcweir if ( nOrientation == 2 )
361cdf0e10cSrcweir mpAcc->SetPixel( nHeight - 1 - ny, ( nWidth - 1 - nx ), BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) );
362cdf0e10cSrcweir else
363cdf0e10cSrcweir mpAcc->SetPixel( nx, ( nHeight - 1 - ny ), BitmapColor( (sal_uInt8)nRed, (sal_uInt8)nGreen, (sal_uInt8)nBlue ) );
364cdf0e10cSrcweir }
365cdf0e10cSrcweir }
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
368cdf0e10cSrcweir if ( pPCD->GetError() )
369cdf0e10cSrcweir bStatus = sal_False;
370cdf0e10cSrcweir MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * nYPair / nH2 );
371cdf0e10cSrcweir if ( bStatus == sal_False )
372cdf0e10cSrcweir break;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir rtl_freeMemory((void*)pL0 );
375cdf0e10cSrcweir rtl_freeMemory((void*)pL1 );
376cdf0e10cSrcweir rtl_freeMemory((void*)pCb );
377cdf0e10cSrcweir rtl_freeMemory((void*)pCr );
378cdf0e10cSrcweir rtl_freeMemory((void*)pL0N);
379cdf0e10cSrcweir rtl_freeMemory((void*)pL1N);
380cdf0e10cSrcweir rtl_freeMemory((void*)pCbN);
381cdf0e10cSrcweir rtl_freeMemory((void*)pCrN);
382cdf0e10cSrcweir }
383cdf0e10cSrcweir
384cdf0e10cSrcweir //================== GraphicImport - die exportierte Funktion ================
385cdf0e10cSrcweir
GraphicImport(SvStream & rStream,Graphic & rGraphic,FilterConfigItem * pConfigItem,sal_Bool)386cdf0e10cSrcweir extern "C" sal_Bool __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pConfigItem, sal_Bool )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir PCDReader aPCDReader;
389cdf0e10cSrcweir return aPCDReader.ReadPCD( rStream, rGraphic, pConfigItem );
390cdf0e10cSrcweir }
391cdf0e10cSrcweir
392