LibreOffice Module vcl (master) 1
svpgdi.hxx
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#pragma once
21
22#ifdef IOS
23#error This file is not for iOS
24#endif
25
26#include <sal/config.h>
27#include <config_features.h>
28
29#include <osl/endian.h>
30#include <vcl/sysdata.hxx>
31#include <config_cairo_canvas.h>
32
34#include <salgdi.hxx>
35#include <sallayout.hxx>
37#include <impfontmetricdata.hxx>
38
41
42struct BitmapBuffer;
43class FreetypeFont;
44
46{
48
49public:
50 void setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize);
51 cairo_surface_t* getSurface() const { return m_aCairoCommon.m_pSurface; }
53 {
55 }
56
57protected:
59 std::unique_ptr<SvpGraphicsBackend> m_pBackend;
60
62
63public:
65 virtual ~SvpSalGraphics() override;
66
67 virtual SalGraphicsImpl* GetImpl() const override { return m_pBackend.get(); }
68 std::unique_ptr<SvpGraphicsBackend> const& getSvpBackend() { return m_pBackend; }
69
70 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
71
72 virtual void SetTextColor( Color nColor ) override;
73 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
74 virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
75 virtual FontCharMapRef GetFontCharMap() const override;
76 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
78 virtual void ClearDevFontCache() override;
79 virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
80 virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
81 virtual void FreeEmbedFontData( const void* pData, tools::Long nDataLen ) override;
82 virtual std::unique_ptr<GenericSalLayout>
83 GetTextLayout(int nFallbackLevel) override;
84 virtual void DrawTextLayout( const GenericSalLayout& ) override;
85
86 virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const override;
87
88 virtual SystemGraphicsData GetGraphicsData() const override;
89
90#if ENABLE_CAIRO_CANVAS
91 virtual bool SupportsCairo() const override;
92 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
93 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
94 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
95 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
96#endif // ENABLE_CAIRO_CANVAS
97
99 {
100 return m_aCairoCommon.getCairoContext(/*bXorModeAllowed*/false, getAntiAlias());
101 }
102
103 void releaseCairoContext(cairo_t* cr, const basegfx::B2DRange& rExtents) const
104 {
105 return m_aCairoCommon.releaseCairoContext(cr, /*bXorModeAllowed*/false, rExtents);
106 }
107
109 {
110 m_aCairoCommon.clipRegion(cr);
111 }
112 void copySource(const SalTwoRect& rTR, cairo_surface_t* source)
113 {
114 m_aCairoCommon.copySource(rTR, source, getAntiAlias());
115 }
116};
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _cairo_surface cairo_surface_t
Definition: CairoCommon.hxx:72
struct _cairo cairo_t
Definition: CairoCommon.hxx:71
struct _cairo_user_data_key cairo_user_data_key_t
Definition: CairoCommon.hxx:73
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
Implementation class for SalGraphics.
Definition: salgdiimpl.hxx:51
bool getAntiAlias() const
Definition: salgdi.hxx:92
void releaseCairoContext(cairo_t *cr, const basegfx::B2DRange &rExtents) const
Definition: svpgdi.hxx:103
virtual FontCharMapRef GetFontCharMap() const override
std::unique_ptr< SvpGraphicsBackend > const & getSvpBackend()
Definition: svpgdi.hxx:68
virtual void ClearDevFontCache() override
virtual void SetFont(LogicalFontInstance *, int nFallbackLevel) override
static cairo_user_data_key_t * getDamageKey()
Definition: svpgdi.hxx:52
virtual void DrawTextLayout(const GenericSalLayout &) override
cairo_t * getCairoContext() const
Definition: svpgdi.hxx:98
virtual const void * GetEmbedFontData(const vcl::font::PhysicalFontFace *, tools::Long *pDataLen) override
cairo_surface_t * getSurface() const
Definition: svpgdi.hxx:51
virtual void SetTextColor(Color nColor) override
virtual SalGraphicsImpl * GetImpl() const override
Definition: svpgdi.hxx:67
void copySource(const SalTwoRect &rTR, cairo_surface_t *source)
Definition: svpgdi.hxx:112
virtual std::unique_ptr< GenericSalLayout > GetTextLayout(int nFallbackLevel) override
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY) override
SvpCairoTextRender m_aTextRenderImpl
Definition: svpgdi.hxx:58
virtual bool ShouldDownscaleIconsAtSurface(double *pScaleOut) const override
void clipRegion(cairo_t *cr)
Definition: svpgdi.hxx:108
virtual ~SvpSalGraphics() override
virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection *, const OUString &rFileURL, const OUString &rFontName) override
cairo_t * createTmpCompatibleCairoContext() const
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *) override
void setSurface(cairo_surface_t *pSurface, const basegfx::B2IVector &rSize)
virtual SystemGraphicsData GetGraphicsData() const override
CairoCommon m_aCairoCommon
Definition: svpgdi.hxx:47
virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override
std::unique_ptr< SvpGraphicsBackend > m_pBackend
Definition: svpgdi.hxx:59
virtual void GetFontMetric(ImplFontMetricDataRef &, int nFallbackLevel) override
virtual void FreeEmbedFontData(const void *pData, tools::Long nDataLen) override
abstract base class for physical font faces
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:36
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:34
long Long
void clipRegion(cairo_t *cr)
cairo_t * getCairoContext(bool bXorModeAllowed, bool bAntiAlias) const
void copySource(const SalTwoRect &rTR, cairo_surface_t *source, bool bAntiAlias)
cairo_surface_t * m_pSurface
void releaseCairoContext(cairo_t *cr, bool bXorModeAllowed, const basegfx::B2DRange &rExtents) const
static cairo_user_data_key_t * getDamageKey()