LibreOffice Module vcl (master) 1
win/salbmp.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_VCL_INC_WIN_SALBMP_H
21#define INCLUDED_VCL_INC_WIN_SALBMP_H
22
23#include <tools/gen.hxx>
24#include <win/wincomp.hxx>
25#include <salbmp.hxx>
27#include <memory>
28
29
30struct BitmapBuffer;
31class BitmapColor;
32class BitmapPalette;
33class SalGraphics;
34namespace Gdiplus { class Bitmap; }
35
37{
38private:
40 HGLOBAL mhDIB;
41 HBITMAP mhDDB;
42
43 sal_uInt16 mnBitCount;
44
45 std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource);
46 std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap();
47
48public:
49
50 HGLOBAL ImplGethDIB() const { return mhDIB; }
51 HBITMAP ImplGethDDB() const { return mhDDB; }
52
53 std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = nullptr) const;
54
55 static HGLOBAL ImplCreateDIB( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal );
56 static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB );
57 static sal_uInt16 ImplGetDIBColorCount( HGLOBAL hDIB );
58
59public:
60
62 virtual ~WinSalBitmap() override;
63
66 using SystemDependentDataHolder::addOrReplaceSystemDependentData;
67 using SystemDependentDataHolder::getSystemDependentData;
68
69public:
70
71 bool Create( HANDLE hBitmap );
72 virtual bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override;
73 virtual bool Create( const SalBitmap& rSalBmpImpl ) override;
74 virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ) override;
75 virtual bool Create( const SalBitmap& rSalBmpImpl, vcl::PixelFormat eNewPixelFormat ) override;
76 virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
77 Size& rSize,
78 bool bMask = false ) override;
79
80 virtual void Destroy() override;
81
82 virtual Size GetSize() const override { return maSize; }
83 virtual sal_uInt16 GetBitCount() const override { return mnBitCount; }
84
85 virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
86 virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
87 virtual bool GetSystemData( BitmapSystemData& rData ) override;
88
89 virtual bool ScalingSupported() const override;
90 virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
91 virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
92
94};
95
96#endif // INCLUDED_VCL_INC_WIN_SALBMP_H
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapAccessMode
std::shared_ptr< T > getSystemDependentData() const
Definition: salbmp.hxx:159
std::shared_ptr< T > addOrReplaceSystemDependentData(Args &&... args) const
Definition: salbmp.hxx:168
std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap *pAlphaSource=nullptr) const
virtual bool Scale(const double &rScaleX, const double &rScaleY, BmpScaleFlag nScaleFlag) override
virtual BitmapBuffer * AcquireBuffer(BitmapAccessMode nMode) override
virtual sal_uInt16 GetBitCount() const override
Definition: win/salbmp.h:83
virtual ~WinSalBitmap() override
virtual bool Create(const SalBitmap &rSalBmpImpl, vcl::PixelFormat eNewPixelFormat) override
virtual bool Replace(const Color &rSearchColor, const Color &rReplaceColor, sal_uInt8 nTol) override
HBITMAP ImplGethDDB() const
Definition: win/salbmp.h:51
std::shared_ptr< Gdiplus::Bitmap > ImplCreateGdiPlusBitmap()
virtual bool Create(const SalBitmap &rSalBmpImpl) override
static HANDLE ImplCopyDIBOrDDB(HANDLE hHdl, bool bDIB)
virtual void ReleaseBuffer(BitmapBuffer *pBuffer, BitmapAccessMode nMode) override
virtual void Destroy() override
virtual bool Create(const css::uno::Reference< css::rendering::XBitmapCanvas > &rBitmapCanvas, Size &rSize, bool bMask=false) override
virtual bool Create(const SalBitmap &rSalBmpImpl, SalGraphics *pGraphics) override
virtual const basegfx::SystemDependentDataHolder * accessSystemDependentDataHolder() const override
sal_uInt16 mnBitCount
Definition: win/salbmp.h:43
HGLOBAL mhDIB
Definition: win/salbmp.h:40
HGLOBAL ImplGethDIB() const
Definition: win/salbmp.h:50
virtual bool GetSystemData(BitmapSystemData &rData) override
static HGLOBAL ImplCreateDIB(const Size &rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette &rPal)
static sal_uInt16 ImplGetDIBColorCount(HGLOBAL hDIB)
HBITMAP mhDDB
Definition: win/salbmp.h:41
virtual Size GetSize() const override
Definition: win/salbmp.h:82
virtual bool Create(const Size &rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette &rPal) override
bool Create(HANDLE hBitmap)
std::shared_ptr< Gdiplus::Bitmap > ImplCreateGdiPlusBitmap(const WinSalBitmap &rAlphaSource)
virtual bool ScalingSupported() const override
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:20
unsigned char sal_uInt8