/* -*- 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/. */ #pragma once #include #include #include namespace vcl::bitmap { /** * Intended to be used to feed into CreateFromData to create a BitmapEx. RGB data format. */ class VCL_DLLPUBLIC RawBitmap { friend BitmapEx VCL_DLLPUBLIC CreateFromData(RawBitmap&& rawBitmap); std::unique_ptr mpData; Size maSize; sal_uInt8 mnBitCount; public: RawBitmap(Size const& rSize, sal_uInt8 nBitCount) : maSize(rSize) , mnBitCount(nBitCount) { assert(nBitCount == 24 || nBitCount == 32); if (rSize.getWidth() > std::numeric_limits::max() || rSize.getWidth() < 0) throw std::bad_alloc(); if (rSize.getHeight() > std::numeric_limits::max() || rSize.getHeight() < 0) throw std::bad_alloc(); sal_Int32 nRowSize, nDataSize; if (o3tl::checked_multiply(rSize.getWidth(), nBitCount / 8, nRowSize) || o3tl::checked_multiply(nRowSize, rSize.getHeight(), nDataSize) || nDataSize < 0) { throw std::bad_alloc(); } mpData.reset(new sal_uInt8[nDataSize]); } void SetPixel(tools::Long nY, tools::Long nX, Color nColor) { tools::Long p = (nY * maSize.getWidth() + nX) * (mnBitCount / 8); mpData[p++] = nColor.GetRed(); mpData[p++] = nColor.GetGreen(); mpData[p++] = nColor.GetBlue(); if (mnBitCount == 32) mpData[p] = nColor.GetAlpha(); } void SetAlpha(tools::Long nY, tools::Long nX, sal_uInt8 nAlpha) { assert(mnBitCount == 32); tools::Long p = (nY * maSize.getWidth() + nX) * (mnBitCount / 8) + 3; mpData[p] = nAlpha; } Color GetPixel(tools::Long nY, tools::Long nX) const { tools::Long p = (nY * maSize.getWidth() + nX) * mnBitCount / 8; if (mnBitCount == 24) return Color(mpData[p], mpData[p + 1], mpData[p + 2]); else return Color(ColorAlpha, mpData[p + 3], mpData[p], mpData[p + 1], mpData[p + 2]); } // so we don't accidentally leave any code in that uses palette color indexes void SetPixel(tools::Long nY, tools::Long nX, BitmapColor nColor) = delete; tools::Long Height() const { return maSize.Height(); } tools::Long Width() const { return maSize.Width(); } sal_uInt8 GetBitCount() const { return mnBitCount; } }; } // end vcl::bitmap /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ llabora/co-24.04.3 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/sc/sdi
AgeCommit message (Expand)Author
2015-09-15tdf#73691 - add alt-x support to calcJustin Luth
2015-08-09tdf#79741: Macro with Find @ Replace crash CalcJulien Nabet
2015-07-16sc: Disable the alignment group buttonMaxim Monastirsky
2015-07-15Convert insert buttons to the generic controllerMaxim Monastirsky
2015-07-10Kill SID_TBXCTL_INSOBJMaxim Monastirsky
2015-07-08tdf#87702: Addition of Shadow sidebar tabRishabh Kumar
2015-07-01tdf#86179 inc/dec font is missing in some shellsMaxim Monastirsky
2015-06-05CALC: readd InsertRows/InsertColsPhilippe Jung
2015-05-31Calc: Insert row/col before/after [2/2]Philippe Jung
2015-05-31Calc: Insert row/col before/after [1/2]Philippe Jung
2015-05-12tdf#84153: "Edit Comment" in context menu when a cell has a commentRavindra_Vidhate
2015-05-05tdf#34555 add to scalc: crop, change img, save img, edit with ext toolsPhilippe Jung
2015-01-09translate all remaining abuses of "ueberladen"Michael Stahl
2014-12-07Introduce ParaspaceIncrease/Decrease commands in Writer and CalcMaxim Monastirsky
2014-12-05fdo85897 Make 'Function List' only accessible in sidebarSamuel Mehrbrodt
2014-11-18fdo#76868 Add chi-square test Statistics DialogTomaž Vajngerl
2014-11-15fdo#74669 Add z-test Statistics DialogTomaž Vajngerl
2014-10-02New feature to allow converting formula cells to static values.Kohei Yoshida
2014-08-24fdo#73151 Make better use of the sidebarSamuel Mehrbrodt
2014-05-23fdo#79011: Properly implement the search results dialog as modeless.Kohei Yoshida
2014-05-02Implement "fill single edit" mode and map it to Ctrl-' by default.Kohei Yoshida
2014-04-24sc: Add F-Test to StatisticsTomaž Vajngerl
2014-03-19fdo#64290 ui:count selected rows and columnsgdm.manmeet
2014-03-05fdo#67104 Use correct command for show gridMaxim Monastirsky
2014-03-03Remove visual noise from scAlexander Wilms
2013-11-30Add t-test Statistics Dialog.Tomaž Vajngerl
2013-11-28make data streams an experimental featureMatúš Kukan
2013-11-13datastreams: add toolbar buttons to stop / resume streamingMatúš Kukan
2013-11-13add menu item for data streams dialogMatúš Kukan
2013-11-11Add statistics dialog for calculation of moving average.Tomaž Vajngerl
2013-11-11New statistics function: Exponential SmoothingTomaž Vajngerl
2013-08-29add support for in-place style previewNoel Power
2013-07-28fdo#66477 Add correlation and covariance to Calc.Tomaž Vajngerl