本文整理汇总了C++中CFbsBitmap::SetScanLine方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmap::SetScanLine方法的具体用法?C++ CFbsBitmap::SetScanLine怎么用?C++ CFbsBitmap::SetScanLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitmap
的用法示例。
在下文中一共展示了CFbsBitmap::SetScanLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyBitmapData
// -----------------------------------------------------------------------------
// CMaskedBitmap::CopyBitmapData
// -----------------------------------------------------------------------------
TInt BitmapUtil::CopyBitmapData( const CFbsBitmap& aSource, CFbsBitmap& aDestination,
const TSize& aSize, const TDisplayMode& aDisplayMode )
{
HBufC8* scanLine = HBufC8::New( aSource.ScanLineLength( aSize.iWidth, aDisplayMode ) );
if( scanLine )
{
TPtr8 scanPtr( scanLine->Des() );
TPoint pp;
for( pp.iY = 0; pp.iY < aSize.iHeight; ++pp.iY )
{
aSource.GetScanLine( scanPtr, pp, aSize.iWidth, aDisplayMode );
aDestination.SetScanLine( scanPtr, pp.iY );
}
delete scanLine;
return KErrNone;
}
return KErrNoMemory; // scanLine alloc failed
}
示例2: ProcessL
/*
-----------------------------------------------------------------------------
ProcessL
Process image referenced by aImage (modify aImage).
May leave with KErrNoMemory if no memory available
Return Values: none
-----------------------------------------------------------------------------
*/
void CDCDithering::ProcessL(CFbsBitmap& aImage)
{
TUint r, g, b; // Color components
TUint8* dataPtr; // Pointer to data
//Dithering variables, init to 0
TInt count=0;
TInt16 dither=0;
//EColor16M image is needed
if (aImage.DisplayMode() != EColor16M || aImage.DisplayMode() != EColor16M)
return;
// Line Buffer and pointer to the data
TUint imageWidth = aImage.SizeInPixels().iWidth;
TUint scanLineLengthInBytes = aImage.ScanLineLength(imageWidth, aImage.DisplayMode());
//Allocate buffer for scanline
iScanLineBuffer = HBufC8::NewMaxL(scanLineLengthInBytes);
//Pointer to scanline
TPtr8 linePtr = iScanLineBuffer->Des();
//Step through image lines
for (TInt lineNo=0; lineNo<aImage.SizeInPixels().iHeight; ++lineNo)
{
//Get line
aImage.GetScanLine(linePtr, TPoint(0, lineNo), imageWidth, aImage.DisplayMode());
//CHECK! CONST_CAST not used in every algorithm which way is better?
dataPtr = CONST_CAST(TUint8*, linePtr.Ptr());
//Step through image pixels
for (TUint x=0; x < imageWidth; ++x)
{
// Get original values
b = *dataPtr++;
g = *dataPtr++;
r = *dataPtr++;
//Compute DCDithering factor from base count
switch (count&1)
{
case 0:
dither = (TInt16)(dither*0x7ffd);
break;
case 1:
dither = (TInt16)(dither+0x7f21);
break;
}
//Add DCDithering factor, adjust gain according to quantization factors.
r = Limit255((TInt)r + (dither>>13));
g = Limit255((TInt)g - (dither>>14));
b = Limit255((TInt)b + (dither>>13));
//Move to the previous pixel
dataPtr -= 3;
/* Set the result */
*dataPtr++ = (TUint8)b;
*dataPtr++ = (TUint8)g;
*dataPtr++ = (TUint8)r;
//Increase bae count
count++;
}
//Set scan line
aImage.SetScanLine(linePtr, lineNo);
}
//Free allocated memory
delete(iScanLineBuffer);
iScanLineBuffer = 0;
}