/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
void BitmapExTest::testGetPixelColor32()
{ // Check backend capabilities and return from the test successfully // if the backend doesn't support 32-bit bitmap if (!ImplGetSVData()->mpDefInst->supportsBitmap32()) return;
void BitmapExTest::testTransformBitmapEx()
{
Bitmap aBitmap(Size(16, 16), vcl::PixelFormat::N24_BPP);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
pWriteAccess->Erase(COL_WHITE); for (int i = 0; i < 8; ++i)
{ for (int j = 0; j < 8; ++j)
{
pWriteAccess->SetPixel(i, j, COL_BLACK);
}
}
}
BitmapEx aBitmapEx(aBitmap);
basegfx::B2DHomMatrix aMatrix;
aMatrix.rotate(M_PI / 2);
BitmapEx aTransformed = aBitmapEx.TransformBitmapEx(16, 16, aMatrix);
aBitmap = aTransformed.GetBitmap();
BitmapScopedReadAccess pAccess(aBitmap); for (int i = 0; i < 16; ++i)
{ for (int j = 0; j < 16; ++j)
{
BitmapColor aColor = pAccess->GetPixel(i, j);
std::stringstream ss;
ss << "Color is expected to be white or black, is '" << aColor.AsRGBHexString() << "'"; // Without the accompanying fix in place, this test would have failed with: // - Expression: aColor == COL_WHITE || aColor == COL_BLACK // - Color is expected to be white or black, is 'bfbfbf' // i.e. smoothing introduced noise for a simple 90 deg rotation.
CPPUNIT_ASSERT_MESSAGE(ss.str(), aColor == COL_WHITE || aColor == COL_BLACK);
}
}
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.