pngwrite.cxx (9f62ea84) | pngwrite.cxx (87bc88d3) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 352 unchanged lines hidden (view full) --- 361 ImplCloseChunk(); 362 delete[] pTempBuf; 363} 364 365// ------------------------------------------------------------------------ 366 367void PNGWriterImpl::ImplWriteTransparent () 368{ | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 352 unchanged lines hidden (view full) --- 361 ImplCloseChunk(); 362 delete[] pTempBuf; 363} 364 365// ------------------------------------------------------------------------ 366 367void PNGWriterImpl::ImplWriteTransparent () 368{ |
369 const sal_uLong nTransIndex = mpAccess->GetBestMatchingColor( BMP_COL_TRANS ); | 369 const sal_uLong nTransIndex = mpAccess->GetBestPaletteIndex( BMP_COL_TRANS ); |
370 371 ImplOpenChunk( PNGCHUNK_tRNS ); 372 373 for ( sal_uLong n = 0UL; n <= nTransIndex; n++ ) 374 ImplWriteChunk( ( nTransIndex == n ) ? (sal_uInt8) 0x0 : (sal_uInt8) 0xff ); 375 376 ImplCloseChunk(); 377} --- 134 unchanged lines hidden (view full) --- 512 { 513 case( 1 ): 514 { 515 sal_uLong nX, nXIndex; 516 for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+=nXAdd, nXIndex++ ) 517 { 518 sal_uLong nShift = ( nXIndex & 7 ) ^ 7; 519 if ( nShift == 7) | 370 371 ImplOpenChunk( PNGCHUNK_tRNS ); 372 373 for ( sal_uLong n = 0UL; n <= nTransIndex; n++ ) 374 ImplWriteChunk( ( nTransIndex == n ) ? (sal_uInt8) 0x0 : (sal_uInt8) 0xff ); 375 376 ImplCloseChunk(); 377} --- 134 unchanged lines hidden (view full) --- 512 { 513 case( 1 ): 514 { 515 sal_uLong nX, nXIndex; 516 for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+=nXAdd, nXIndex++ ) 517 { 518 sal_uLong nShift = ( nXIndex & 7 ) ^ 7; 519 if ( nShift == 7) |
520 *pDest = (sal_uInt8)(mpAccess->GetPixel( nY, nX ) << nShift); | 520 *pDest = mpAccess->GetPixelIndex( nY, nX ) << nShift; |
521 else if ( nShift == 0 ) | 521 else if ( nShift == 0 ) |
522 *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift; | 522 *pDest++ |= mpAccess->GetPixelIndex( nY, nX ) << nShift; |
523 else | 523 else |
524 *pDest |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift; | 524 *pDest |= mpAccess->GetPixelIndex( nY, nX ) << nShift; |
525 } 526 if ( ( nXIndex & 7 ) != 0 ) pDest++; // byte is not completely used, so the 527 } // bufferpointer is to correct 528 break; 529 530 case( 4 ): 531 { 532 sal_uLong nX, nXIndex; 533 for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+= nXAdd, nXIndex++ ) 534 { 535 if( nXIndex & 1 ) | 525 } 526 if ( ( nXIndex & 7 ) != 0 ) pDest++; // byte is not completely used, so the 527 } // bufferpointer is to correct 528 break; 529 530 case( 4 ): 531 { 532 sal_uLong nX, nXIndex; 533 for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+= nXAdd, nXIndex++ ) 534 { 535 if( nXIndex & 1 ) |
536 *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX ); | 536 *pDest++ |= mpAccess->GetPixelIndex( nY, nX ); |
537 else | 537 else |
538 *pDest = (sal_uInt8) mpAccess->GetPixel( nY, nX ) << 4; | 538 *pDest = mpAccess->GetPixelIndex( nY, nX ) << 4; |
539 } 540 if ( nXIndex & 1 ) pDest++; 541 } 542 break; 543 544 case( 8 ): 545 { 546 for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) | 539 } 540 if ( nXIndex & 1 ) pDest++; 541 } 542 break; 543 544 case( 8 ): 545 { 546 for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) |
547 *pDest++ = mpAccess->GetPixel( nY, nX ); | 547 *pDest++ = mpAccess->GetPixelIndex( nY, nX ); |
548 } 549 break; 550 551 default : 552 mbStatus = sal_False; 553 break; 554 } 555 } --- 4 unchanged lines hidden (view full) --- 560 if ( mbTrueAlpha ) 561 { 562 for ( sal_uLong nX = nXStart; nX < mnWidth; nX += nXAdd ) 563 { 564 const BitmapColor& rColor = mpAccess->GetPixel( nY, nX ); 565 *pDest++ = rColor.GetRed(); 566 *pDest++ = rColor.GetGreen(); 567 *pDest++ = rColor.GetBlue(); | 548 } 549 break; 550 551 default : 552 mbStatus = sal_False; 553 break; 554 } 555 } --- 4 unchanged lines hidden (view full) --- 560 if ( mbTrueAlpha ) 561 { 562 for ( sal_uLong nX = nXStart; nX < mnWidth; nX += nXAdd ) 563 { 564 const BitmapColor& rColor = mpAccess->GetPixel( nY, nX ); 565 *pDest++ = rColor.GetRed(); 566 *pDest++ = rColor.GetGreen(); 567 *pDest++ = rColor.GetBlue(); |
568 *pDest++ = 255 - mpMaskAccess->GetPixel( nY, nX ); | 568 *pDest++ = 255 - mpMaskAccess->GetPixelIndex( nY, nX ); |
569 } 570 } 571 else 572 { 573 const BitmapColor aTrans( mpMaskAccess->GetBestMatchingColor( Color( COL_WHITE ) ) ); 574 575 for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) 576 { --- 157 unchanged lines hidden --- | 569 } 570 } 571 else 572 { 573 const BitmapColor aTrans( mpMaskAccess->GetBestMatchingColor( Color( COL_WHITE ) ) ); 574 575 for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd ) 576 { --- 157 unchanged lines hidden --- |