bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / quartz / salbmp.h
blob8a9e94d043cc4359e452890329cc4b7ca7e82dfd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_QUARTZ_SALBMP_H
21 #define INCLUDED_VCL_INC_QUARTZ_SALBMP_H
23 #include <tools/gen.hxx>
25 #include <vcl/BitmapBuffer.hxx>
26 #include <vcl/BitmapPalette.hxx>
28 #include <quartz/salgdi.h>
30 #include <salinst.hxx>
31 #include <salvd.hxx>
32 #include <salbmp.hxx>
34 #include <memory>
37 struct BitmapBuffer;
38 class BitmapPalette;
40 class QuartzSalBitmap : public SalBitmap
42 public:
43 CGContextHolder maGraphicContext;
44 mutable CGImageRef mxCachedImage;
45 BitmapPalette maPalette;
46 std::shared_ptr<sal_uInt8> m_pUserBuffer;
47 std::shared_ptr<sal_uInt8> m_pContextBuffer;
48 sal_uInt16 mnBits;
49 int mnWidth;
50 int mnHeight;
51 sal_uInt32 mnBytesPerRow;
53 public:
54 QuartzSalBitmap();
55 virtual ~QuartzSalBitmap() override;
57 public:
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;
68 void Destroy() override;
70 Size GetSize() const override;
71 sal_uInt16 GetBitCount() const override;
73 BitmapBuffer *AcquireBuffer( BitmapAccessMode nMode ) override;
74 void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
76 bool GetSystemData( BitmapSystemData& rData ) override;
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;
82 private:
83 // quartz helper
84 bool CreateContext();
85 void DestroyContext();
86 bool AllocateUserData();
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 );
92 public:
93 bool Create(CGLayerHolder const & rLayerHolder, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bFlipped);
95 public:
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;
100 void doDestroy();
103 #endif // INCLUDED_VCL_INC_QUARTZ_SALBMP_H
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */