/* -*- 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void BitmapWriteAccess::CopyScanline(tools::Long nY, const BitmapReadAccess& rReadAcc)
{
assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!");
SAL_WARN_IF(nY >= rReadAcc.Height(), "vcl", "y-coordinate in source out of range!");
SAL_WARN_IF((!HasPalette() || !rReadAcc.HasPalette())
&& (HasPalette() || rReadAcc.HasPalette()), "vcl", "No copying possible between palette bitmap and TC bitmap!");
assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!");
DBG_ASSERT((HasPalette() && eFormat <= ScanlineFormat::N8BitPal)
|| (!HasPalette() && eFormat > ScanlineFormat::N8BitPal), "No copying possible between palette and non palette scanlines!");
void BitmapWriteAccess::Erase(const Color& rColor)
{ // convert the color format from RGB to palette index if needed // TODO: provide and use Erase( BitmapColor& method)
BitmapColor aColor = rColor; if (HasPalette())
{
aColor = BitmapColor(static_cast<sal_uInt8>(GetBestPaletteIndex(rColor)));
}
// try fast bitmap method first if (ImplFastEraseBitmap(*mpBuffer, aColor)) return;
tools::Rectangle aRect(Point(), maBitmap.GetSizePixel()); if (aRect.IsEmpty()) return; // clear the bitmap by filling the first line pixel by pixel, // then dup the first line over each other line
Scanline pFirstScanline = GetScanline(0); const tools::Long nEndX = aRect.Right(); for (tools::Long nX = 0; nX <= nEndX; ++nX)
SetPixelOnData(pFirstScanline, nX, rColor); constauto nScanlineSize = GetScanlineSize(); const tools::Long nEndY = aRect.Bottom(); for (tools::Long nY = 1; nY <= nEndY; nY++)
{
Scanline pDestScanline = GetScanline(nY);
memcpy(pDestScanline, pFirstScanline, nScanlineSize);
}
}
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 ist noch experimentell.