Update ooo320-m1
[ooovba.git] / goodies / source / filter.vcl / itga / itga.cxx
blob96e29875003d8ff322cf28a1901a7953202cbe80
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: itga.cxx,v $
10 * $Revision: 1.11 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
34 #include <vcl/graph.hxx>
35 #include <vcl/bmpacc.hxx>
36 #include <svtools/fltcall.hxx>
38 //============================ TGAReader ==================================
40 struct TGAFileHeader
42 BYTE nImageIDLength;
43 BYTE nColorMapType;
44 BYTE nImageType;
45 UINT16 nColorMapFirstEntryIndex;
46 UINT16 nColorMapLength;
47 BYTE nColorMapEntrySize;
48 UINT16 nColorMapXOrigin;
49 UINT16 nColorMapYOrigin;
50 UINT16 nImageWidth;
51 UINT16 nImageHeight;
52 BYTE nPixelDepth;
53 BYTE nImageDescriptor;
56 #define SizeOfTGAFileFooter 26
58 struct TGAFileFooter
60 UINT32 nExtensionFileOffset;
61 UINT32 nDeveloperDirectoryOffset;
62 UINT32 nSignature[4];
63 BYTE nPadByte;
64 BYTE nStringTerminator;
67 #define SizeOfTGAExtension 495
69 struct TGAExtension
71 UINT16 nExtensionSize;
72 char sAuthorName[41];
73 char sAuthorComment[324];
74 char sDateTimeStamp[12];
75 char sJobNameID[41];
76 UINT16 nJobTime[3];
77 char sSoftwareID[41];
78 UINT16 nSoftwareVersionNumber;
79 BYTE nSoftwareVersionLetter;
80 UINT32 nKeyColor;
81 UINT16 nPixelAspectRatioNumerator;
82 UINT16 nPixelAspectRatioDeNumerator;
83 UINT16 nGammaValueNumerator;
84 UINT16 nGammaValueDeNumerator;
85 UINT32 nColorCorrectionOffset;
86 UINT32 nPostageStampOffset;
87 UINT32 nScanLineOffset;
88 BYTE nAttributesType;
91 class TGAReader {
93 private:
95 SvStream* mpTGA;
97 BitmapWriteAccess* mpAcc;
98 TGAFileHeader* mpFileHeader;
99 TGAFileFooter* mpFileFooter;
100 TGAExtension* mpExtension;
101 UINT32* mpColorMap;
103 BOOL mbStatus;
105 ULONG mnTGAVersion; // Enhanced TGA is defined as Version 2.0
106 UINT16 mnDestBitDepth;
107 BOOL mbIndexing; // TRUE if source contains indexing color values
108 BOOL mbEncoding; // TRUE if source is compressed
110 BOOL ImplReadHeader();
111 BOOL ImplReadPalette();
112 BOOL ImplReadBody();
114 public:
115 TGAReader();
116 ~TGAReader();
117 BOOL ReadTGA( SvStream & rTGA, Graphic & rGraphic );
120 //=================== Methoden von TGAReader ==============================
122 TGAReader::TGAReader() :
123 mpAcc ( NULL ),
124 mpFileHeader ( NULL ),
125 mpFileFooter ( NULL ),
126 mpExtension ( NULL ),
127 mpColorMap ( NULL ),
128 mbStatus ( TRUE ),
129 mnTGAVersion ( 1 ),
130 mbIndexing ( FALSE ),
131 mbEncoding ( FALSE )
135 TGAReader::~TGAReader()
137 delete[] mpColorMap;
138 delete mpFileHeader;
139 delete mpExtension;
140 delete mpFileFooter;
143 // -------------------------------------------------------------------------------------------
145 BOOL TGAReader::ReadTGA( SvStream & rTGA, Graphic & rGraphic )
147 if ( rTGA.GetError() )
148 return FALSE;
150 mpTGA = &rTGA;
151 mpTGA->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
153 // Kopf einlesen:
155 if ( !mpTGA->GetError() )
157 mbStatus = ImplReadHeader();
158 if ( mbStatus )
160 Bitmap aBitmap;
162 aBitmap = Bitmap( Size( mpFileHeader->nImageWidth, mpFileHeader->nImageHeight ), mnDestBitDepth );
163 mpAcc = aBitmap.AcquireWriteAccess();
164 if ( mpAcc )
166 if ( mbIndexing )
167 mbStatus = ImplReadPalette();
168 if ( mbStatus )
169 mbStatus = ImplReadBody();
171 else
172 mbStatus = FALSE;
174 if ( mpAcc )
175 aBitmap.ReleaseAccess ( mpAcc), mpAcc = NULL;
177 if ( mbStatus )
178 rGraphic = aBitmap;
181 return mbStatus;
184 // -------------------------------------------------------------------------------------------
186 BOOL TGAReader::ImplReadHeader()
188 mpFileHeader = new TGAFileHeader;
189 if ( mpFileHeader == NULL )
190 return FALSE;
192 *mpTGA >> mpFileHeader->nImageIDLength >> mpFileHeader->nColorMapType >> mpFileHeader->nImageType >>
193 mpFileHeader->nColorMapFirstEntryIndex >> mpFileHeader->nColorMapLength >> mpFileHeader->nColorMapEntrySize >>
194 mpFileHeader->nColorMapXOrigin >> mpFileHeader->nColorMapYOrigin >> mpFileHeader->nImageWidth >>
195 mpFileHeader->nImageHeight >> mpFileHeader->nPixelDepth >> mpFileHeader->nImageDescriptor;
197 if ( mpFileHeader->nColorMapType > 1 )
198 return FALSE;
199 if ( mpFileHeader->nColorMapType == 1 )
200 mbIndexing = TRUE;
202 // first we want to get the version
203 mpFileFooter = new TGAFileFooter; // read the TGA-File-Footer to determine whether
204 if ( mpFileFooter ) // we got an old TGA format or the new one
206 ULONG nCurStreamPos = mpTGA->Tell();
207 mpTGA->Seek( STREAM_SEEK_TO_END );
208 ULONG nTemp = mpTGA->Tell();
209 mpTGA->Seek( nTemp - SizeOfTGAFileFooter );
211 *mpTGA >> mpFileFooter->nExtensionFileOffset >> mpFileFooter->nDeveloperDirectoryOffset >>
212 mpFileFooter->nSignature[0] >> mpFileFooter->nSignature[1] >> mpFileFooter->nSignature[2] >>
213 mpFileFooter->nSignature[3] >> mpFileFooter->nPadByte >> mpFileFooter->nStringTerminator;
215 // check for TRUE, VISI, ON-X, FILE in the signatures
216 if ( mpFileFooter->nSignature[ 0 ] == (('T'<<24)|('R'<<16)|('U'<<8)|'E') &&
217 mpFileFooter->nSignature[ 1 ] == (('V'<<24)|('I'<<16)|('S'<<8)|'I') &&
218 mpFileFooter->nSignature[ 2 ] == (('O'<<24)|('N'<<16)|('-'<<8)|'X') &&
219 mpFileFooter->nSignature[ 3 ] == (('F'<<24)|('I'<<16)|('L'<<8)|'E') )
221 mpExtension = new TGAExtension;
222 if ( mpExtension )
224 mpTGA->Seek( mpFileFooter->nExtensionFileOffset );
225 *mpTGA >> mpExtension->nExtensionSize;
226 if ( mpExtension->nExtensionSize >= SizeOfTGAExtension )
228 mnTGAVersion = 2;
230 mpTGA->Read( mpExtension->sAuthorName, 41 );
231 mpTGA->Read( mpExtension->sAuthorComment, 324 );
232 mpTGA->Read( mpExtension->sDateTimeStamp, 12 );
233 mpTGA->Read( mpExtension->sJobNameID, 12 );
234 *mpTGA >> mpExtension->sJobNameID[ 0 ] >> mpExtension->sJobNameID[ 1 ] >> mpExtension->sJobNameID[ 2 ];
235 mpTGA->Read( mpExtension->sSoftwareID, 41 );
236 *mpTGA >> mpExtension->nSoftwareVersionNumber >> mpExtension->nSoftwareVersionLetter
237 >> mpExtension->nKeyColor >> mpExtension->nPixelAspectRatioNumerator
238 >> mpExtension->nPixelAspectRatioDeNumerator >> mpExtension->nGammaValueNumerator
239 >> mpExtension->nGammaValueDeNumerator >> mpExtension->nColorCorrectionOffset
240 >> mpExtension->nPostageStampOffset >> mpExtension->nScanLineOffset
241 >> mpExtension->nAttributesType;
246 mpTGA->Seek( nCurStreamPos );
249 // using the TGA file specification this was the correct form but adobe photoshop sets nImageDescriptor
250 // equal to nPixelDepth
251 // mnDestBitDepth = mpFileHeader->nPixelDepth - ( mpFileHeader->nImageDescriptor & 0xf );
252 mnDestBitDepth = mpFileHeader->nPixelDepth;
254 if ( mnDestBitDepth == 8 ) // this is a patch for grayscale pictures not including a palette
255 mbIndexing = TRUE;
257 if ( mnDestBitDepth > 32 ) // maybe the pixeldepth is invalid
258 return FALSE;
259 else if ( mnDestBitDepth > 8 )
260 mnDestBitDepth = 24;
261 else if ( mnDestBitDepth > 4 )
262 mnDestBitDepth = 8;
263 else if ( mnDestBitDepth > 2 )
264 mnDestBitDepth = 4;
266 if ( !mbIndexing && ( mnDestBitDepth < 15 ) )
267 return FALSE;
269 switch ( mpFileHeader->nImageType )
271 case 9 : // encoding for colortype 9, 10, 11
272 case 10 :
273 case 11 :
274 mbEncoding = TRUE;
275 break;
278 if ( mpFileHeader->nImageIDLength ) // skip the Image ID
279 mpTGA->SeekRel( mpFileHeader->nImageIDLength );
281 return mbStatus;
284 // -------------------------------------------------------------------------------------------
286 BOOL TGAReader::ImplReadBody()
289 USHORT nXCount, nYCount, nRGB16;
290 BYTE nRed, nGreen, nBlue, nRunCount, nDummy, nDepth;
292 // this four variables match the image direction
293 long nY, nYAdd, nX, nXAdd, nXStart;
295 nX = nXStart = nY = 0;
296 nXCount = nYCount = 0;
297 nYAdd = nXAdd = 1;
299 if ( mpFileHeader->nImageDescriptor & 0x10 )
301 nX = nXStart = mpFileHeader->nImageWidth - 1;
302 nXAdd -= 2;
305 if ( !(mpFileHeader->nImageDescriptor & 0x20 ) )
307 nY = mpFileHeader->nImageHeight - 1;
308 nYAdd -=2;
311 // nDepth = mpFileHeader->nPixelDepth - ( mpFileHeader->nImageDescriptor & 0xf );
312 nDepth = mpFileHeader->nPixelDepth;
314 if ( mbEncoding )
316 if ( mbIndexing )
318 switch( nDepth )
320 // 16 bit encoding + indexing
321 case 16 :
322 while ( nYCount < mpFileHeader->nImageHeight )
324 *mpTGA >> nRunCount;
325 if ( nRunCount & 0x80 ) // a run length packet
327 *mpTGA >> nRGB16;
328 if ( nRGB16 >= mpFileHeader->nColorMapLength )
329 return FALSE;
330 nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
331 nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
332 nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
333 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
335 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
336 nX += nXAdd;
337 nXCount++;
338 if ( nXCount == mpFileHeader->nImageWidth )
340 nX = nXStart;
341 nXCount = 0;
342 nY += nYAdd;
343 nYCount++;
347 else // a raw packet
349 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
351 *mpTGA >> nRGB16;
352 if ( nRGB16 >= mpFileHeader->nColorMapLength )
353 return FALSE;
354 nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
355 nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
356 nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
357 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
358 nX += nXAdd;
359 nXCount++;
360 if ( nXCount == mpFileHeader->nImageWidth )
362 nX = nXStart;
363 nXCount = 0;
364 nY += nYAdd;
365 nYCount++;
370 break;
372 // 8 bit encoding + indexing
373 case 8 :
374 while ( nYCount < mpFileHeader->nImageHeight )
376 *mpTGA >> nRunCount;
377 if ( nRunCount & 0x80 ) // a run length packet
379 *mpTGA >> nDummy;
380 if ( nDummy >= mpFileHeader->nColorMapLength )
381 return FALSE;
382 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
384 mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
385 nX += nXAdd;
386 nXCount++;
387 if ( nXCount == mpFileHeader->nImageWidth )
389 nX = nXStart;
390 nXCount = 0;
391 nY += nYAdd;
392 nYCount++;
396 else // a raw packet
398 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
401 *mpTGA >> nDummy;
402 if ( nDummy >= mpFileHeader->nColorMapLength )
403 return FALSE;
404 mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
405 nX += nXAdd;
406 nXCount++;
407 if ( nXCount == mpFileHeader->nImageWidth )
409 nX = nXStart;
410 nXCount = 0;
411 nY += nYAdd;
412 nYCount++;
417 break;
418 default:
419 return FALSE;
422 else
424 switch( nDepth )
426 // 32 bit transparent true color encoding
427 case 32 :
429 while ( nYCount < mpFileHeader->nImageHeight )
431 *mpTGA >> nRunCount;
432 if ( nRunCount & 0x80 ) // a run length packet
434 *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
435 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
437 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
438 nX += nXAdd;
439 nXCount++;
440 if ( nXCount == mpFileHeader->nImageWidth )
442 nX = nXStart;
443 nXCount = 0;
444 nY += nYAdd;
445 nYCount++;
449 else // a raw packet
451 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
453 *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
454 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
455 nX += nXAdd;
456 nXCount++;
457 if ( nXCount == mpFileHeader->nImageWidth )
459 nX = nXStart;
460 nXCount = 0;
461 nY += nYAdd;
462 nYCount++;
468 break;
470 // 24 bit true color encoding
471 case 24 :
472 while ( nYCount < mpFileHeader->nImageHeight )
474 *mpTGA >> nRunCount;
475 if ( nRunCount & 0x80 ) // a run length packet
477 *mpTGA >> nBlue >> nGreen >> nRed;
478 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
480 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
481 nX += nXAdd;
482 nXCount++;
483 if ( nXCount == mpFileHeader->nImageWidth )
485 nX = nXStart;
486 nXCount = 0;
487 nY += nYAdd;
488 nYCount++;
492 else // a raw packet
494 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
496 *mpTGA >> nBlue >> nGreen >> nRed;
497 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
498 nX += nXAdd;
499 nXCount++;
500 if ( nXCount == mpFileHeader->nImageWidth )
502 nX = nXStart;
503 nXCount = 0;
504 nY += nYAdd;
505 nYCount++;
510 break;
512 // 16 bit true color encoding
513 case 16 :
514 while ( nYCount < mpFileHeader->nImageHeight )
516 *mpTGA >> nRunCount;
517 if ( nRunCount & 0x80 ) // a run length packet
519 *mpTGA >> nRGB16;
520 nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
521 nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
522 nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
523 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
525 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
526 nX += nXAdd;
527 nXCount++;
528 if ( nXCount == mpFileHeader->nImageWidth )
530 nX = nXStart;
531 nXCount = 0;
532 nY += nYAdd;
533 nYCount++;
537 else // a raw packet
539 for ( USHORT i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
541 *mpTGA >> nRGB16;
542 nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
543 nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
544 nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
545 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
546 nX += nXAdd;
547 nXCount++;
548 if ( nXCount == mpFileHeader->nImageWidth )
550 nX = nXStart;
551 nXCount = 0;
552 nY += nYAdd;
553 nYCount++;
558 break;
560 default:
561 return FALSE;
565 else
567 for ( nYCount = 0; nYCount < mpFileHeader->nImageHeight; nYCount++, nY += nYAdd )
569 nX = nXStart;
570 nXCount = 0;
572 if ( mbIndexing )
574 switch( nDepth )
576 // 16 bit indexing
577 case 16 :
578 for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
580 *mpTGA >> nRGB16;
581 if ( nRGB16 >= mpFileHeader->nColorMapLength )
582 return FALSE;
583 nRed = (BYTE)( mpColorMap[ nRGB16 ] >> 16 );
584 nGreen = (BYTE)( mpColorMap[ nRGB16 ] >> 8 );
585 nBlue = (BYTE)( mpColorMap[ nRGB16 ] );
586 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
588 break;
590 // 8 bit indexing
591 case 8 :
592 for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
594 *mpTGA >> nDummy;
595 if ( nDummy >= mpFileHeader->nColorMapLength )
596 return FALSE;
597 mpAcc->SetPixel( nY, nX, (BYTE)nDummy );
599 break;
600 default:
601 return FALSE;
604 else
606 switch( nDepth )
608 // 32 bit true color
609 case 32 :
611 for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
613 *mpTGA >> nBlue >> nGreen >> nRed >> nDummy;
614 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
617 break;
619 // 24 bit true color
620 case 24 :
621 for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
623 *mpTGA >> nBlue >> nGreen >> nRed;
624 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
626 break;
628 // 16 bit true color
629 case 16 :
630 for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
632 *mpTGA >> nRGB16;
633 nRed = (BYTE)( nRGB16 >> 7 ) & 0xf8;
634 nGreen = (BYTE)( nRGB16 >> 2 ) & 0xf8;
635 nBlue = (BYTE)( nRGB16 << 3 ) & 0xf8;
636 mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
638 break;
639 default:
640 return FALSE;
645 return mbStatus;
648 // -------------------------------------------------------------------------------------------
650 BOOL TGAReader::ImplReadPalette()
652 if ( mbIndexing ) // read the colormap
654 USHORT nColors = mpFileHeader->nColorMapLength;
656 if ( !nColors ) // colors == 0 ? -> we will build a grayscale palette
658 if ( mpFileHeader->nPixelDepth != 8 )
659 return FALSE;
660 nColors = 256;
661 mpFileHeader->nColorMapLength = 256;
662 mpFileHeader->nColorMapEntrySize = 0x3f; // patch for the following switch routine
664 mpColorMap = new UINT32[ nColors ]; // we will always index dwords
665 if ( mpColorMap == FALSE )
666 return FALSE; // out of memory %&!$&/!"�$
668 switch( mpFileHeader->nColorMapEntrySize )
670 case 0x3f :
672 for ( ULONG i = 0; i < nColors; i++ )
674 mpColorMap[ i ] = ( i << 16 ) + ( i << 8 ) + i;
677 break;
679 case 32 :
680 mpTGA->Read( mpColorMap, 4 * nColors );
681 break;
683 case 24 :
685 for ( ULONG i = 0; i < nColors; i++ )
687 mpTGA->Read( &mpColorMap[ i ], 3 );
690 break;
692 case 15 :
693 case 16 :
695 for ( ULONG i = 0; i < nColors; i++ )
697 UINT16 nTemp;
698 *mpTGA >> nTemp;
699 mpColorMap[ i ] = ( ( nTemp & 0x7c00 ) << 9 ) + ( ( nTemp & 0x01e0 ) << 6 ) +
700 ( ( nTemp & 0x1f ) << 3 );
703 break;
705 default :
706 return FALSE;
708 if ( mnDestBitDepth <= 8 )
710 USHORT nDestColors = ( 1 << mnDestBitDepth );
711 if ( nColors > nDestColors )
712 return FALSE;
714 mpAcc->SetPaletteEntryCount( nColors );
715 for ( USHORT i = 0; i < nColors; i++ )
717 mpAcc->SetPaletteColor( i, Color( (BYTE)( mpColorMap[ i ] >> 16 ),
718 (BYTE)( mpColorMap[ i ] >> 8 ), (BYTE)(mpColorMap[ i ] ) ) );
723 return mbStatus;
726 //================== GraphicImport - die exportierte Funktion ================
728 extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
730 TGAReader aTGAReader;
732 return aTGAReader.ReadTGA( rStream, rGraphic );
735 //================== ein bischen Muell fuer Windows ==========================
736 #ifndef GCC
737 #endif
739 #ifdef WIN
741 static HINSTANCE hDLLInst = 0; // HANDLE der DLL
743 extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
745 #ifndef WNT
746 if ( nHeap )
747 UnlockData( 0 );
748 #endif
750 hDLLInst = hDLL;
752 return TRUE;
755 extern "C" int CALLBACK WEP( int )
757 return 1;
760 #endif