LibreOffice Module vcl (master) 1
quartz/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_QUARTZ_SALBMP_H
21#define INCLUDED_VCL_INC_QUARTZ_SALBMP_H
22
23#include <tools/gen.hxx>
24
25#include <vcl/BitmapBuffer.hxx>
26#include <vcl/BitmapPalette.hxx>
27
28#include <quartz/salgdi.h>
29
30#include <salinst.hxx>
31#include <salvd.hxx>
32#include <salbmp.hxx>
33
34#include <memory>
35
36
37struct BitmapBuffer;
38class BitmapPalette;
39
41{
42public:
44 mutable CGImageRef mxCachedImage;
46 std::shared_ptr<sal_uInt8> m_pUserBuffer;
47 std::shared_ptr<sal_uInt8> m_pContextBuffer;
48 sal_uInt16 mnBits;
51 sal_uInt32 mnBytesPerRow;
52
53public:
55 virtual ~QuartzSalBitmap() override;
56
57public:
58
59 // SalBitmap methods
60 bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override;
61 bool Create( const SalBitmap& rSalBmp ) override;
62 bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override;
63 bool Create( const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) override;
64 virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
65 Size& rSize,
66 bool bMask = false ) override;
67
68 void Destroy() override;
69
70 Size GetSize() const override;
71 sal_uInt16 GetBitCount() const override;
72
74 void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
75
76 bool GetSystemData( BitmapSystemData& rData ) override;
77
78 bool ScalingSupported() const override;
79 bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
80 bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
81
82private:
83 // quartz helper
87
88 void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
89 sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
90 sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData );
91
92public:
93 bool Create(CGLayerHolder const & rLayerHolder, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bFlipped);
94
95public:
96 CGImageRef CreateWithMask( const QuartzSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const;
97 CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, Color nMaskColor ) const;
98 CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const;
99
100 void doDestroy();
101};
102
103#endif // INCLUDED_VCL_INC_QUARTZ_SALBMP_H
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapAccessMode
void ConvertBitmapData(sal_uInt32 nWidth, sal_uInt32 nHeight, sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette &rDestPalette, sal_uInt8 *pDestData, sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette &rSrcPalette, sal_uInt8 *pSrcData)
BitmapBuffer * AcquireBuffer(BitmapAccessMode nMode) override
bool GetSystemData(BitmapSystemData &rData) override
bool CreateContext()
sal_uInt16 GetBitCount() const override
bool Create(const SalBitmap &rSalBmp, SalGraphics *pGraphics) override
CGImageRef CreateCroppedImage(int nX, int nY, int nWidth, int nHeight) const
sal_uInt16 mnBits
Definition: quartz/salbmp.h:48
bool Create(const SalBitmap &rSalBmp, vcl::PixelFormat eNewPixelFormat) override
void DestroyContext()
CGImageRef mxCachedImage
Definition: quartz/salbmp.h:44
virtual bool Create(const css::uno::Reference< css::rendering::XBitmapCanvas > &rBitmapCanvas, Size &rSize, bool bMask=false) override
void ReleaseBuffer(BitmapBuffer *pBuffer, BitmapAccessMode nMode) override
bool Replace(const Color &rSearchColor, const Color &rReplaceColor, sal_uInt8 nTol) override
void Destroy() override
bool ScalingSupported() const override
bool AllocateUserData()
bool Create(const SalBitmap &rSalBmp) override
virtual ~QuartzSalBitmap() override
CGImageRef CreateWithMask(const QuartzSalBitmap &rMask, int nX, int nY, int nWidth, int nHeight) const
BitmapPalette maPalette
Definition: quartz/salbmp.h:45
bool Create(const Size &rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette &rPal) override
std::shared_ptr< sal_uInt8 > m_pUserBuffer
Definition: quartz/salbmp.h:46
std::shared_ptr< sal_uInt8 > m_pContextBuffer
Definition: quartz/salbmp.h:47
sal_uInt32 mnBytesPerRow
Definition: quartz/salbmp.h:51
bool Create(CGLayerHolder const &rLayerHolder, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bFlipped)
CGImageRef CreateColorMask(int nX, int nY, int nWidth, int nHeight, Color nMaskColor) const
bool Scale(const double &rScaleX, const double &rScaleY, BmpScaleFlag nScaleFlag) override
Size GetSize() const override
CGContextHolder maGraphicContext
Definition: quartz/salbmp.h:43
short nBitCount
Definition: ipict.cxx:80
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:20
unsigned char sal_uInt8