LibreOffice Module vcl (master) 1
outdev/eps.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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#include <vcl/gfxlink.hxx>
21#include <vcl/graph.hxx>
22#include <vcl/metaact.hxx>
23#include <vcl/virdev.hxx>
24
25#include <salgdi.hxx>
26
27bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
28 const GfxLink& rGfxLink, GDIMetaFile* pSubst )
29{
30 if ( mpMetaFile )
31 {
32 GDIMetaFile aSubst;
33
34 if( pSubst )
35 aSubst = *pSubst;
36
37 mpMetaFile->AddAction( new MetaEPSAction( rPoint, rSize, rGfxLink, aSubst ) );
38 }
39
41 return true;
42
43 if( mbOutputClipped )
44 return true;
45
46 tools::Rectangle aRect( ImplLogicToDevicePixel( tools::Rectangle( rPoint, rSize ) ) );
47
48 bool bDrawn = true;
49
50 if( !aRect.IsEmpty() )
51 {
52 // draw the real EPS graphics
53 if( rGfxLink.GetData() && rGfxLink.GetDataSize() )
54 {
55 if( !mpGraphics && !AcquireGraphics() )
56 return bDrawn;
57 assert(mpGraphics);
58
61
62 aRect.Normalize();
63 bDrawn = mpGraphics->DrawEPS( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(),
64 const_cast<sal_uInt8*>(rGfxLink.GetData()), rGfxLink.GetDataSize(), *this );
65 }
66
67 // else draw the substitution graphics
68 if( !bDrawn && pSubst )
69 {
70 GDIMetaFile* pOldMetaFile = mpMetaFile;
71
72 mpMetaFile = nullptr;
73 Graphic(*pSubst).Draw(*this, rPoint, rSize);
74 mpMetaFile = pOldMetaFile;
75 }
76 }
77
78 if( mpAlphaVDev )
79 mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst );
80
81 return bDrawn;
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:585
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
Definition: graph.cxx:429
virtual void InitClipRegion()
bool DrawEPS(const Point &rPt, const Size &rSz, const GfxLink &rGfxLink, GDIMetaFile *pSubst=nullptr)
Definition: outdev/eps.cxx:27
bool mbOutputClipped
Definition: outdev.hxx:245
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
Definition: map.cxx:334
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
Definition: outdev.cxx:708
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:185
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:182
bool mbInitClipRegion
Definition: outdev.hxx:252
bool IsDeviceOutputNecessary() const
Definition: outdev.hxx:481
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:196
bool DrawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize, const OutputDevice &rOutDev)
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr bool IsEmpty() const
unsigned char sal_uInt8