LibreOffice Module svgio (master)
1
svgio
source
svgreader
svgfegaussianblurnode.cxx
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
#include <
svgfegaussianblurnode.hxx
>
21
#include <
drawinglayer/primitive2d/softedgeprimitive2d.hxx
>
22
#include <
o3tl/string_view.hxx
>
23
24
namespace
svgio::svgreader
25
{
26
SvgFeGaussianBlurNode::SvgFeGaussianBlurNode
(
SvgDocument
& rDocument,
SvgNode
* pParent)
27
:
SvgFilterNode
(
SVGToken
::
FeGaussianBlur
, rDocument, pParent)
28
, maStdDeviation(
SvgNumber
(0.0))
29
{
30
}
31
32
SvgFeGaussianBlurNode::~SvgFeGaussianBlurNode
() {}
33
34
void
SvgFeGaussianBlurNode::parseAttribute
(
const
OUString&
/*rTokenName*/
,
SVGToken
aSVGToken,
35
const
OUString& aContent)
36
{
37
// parse own
38
switch
(aSVGToken)
39
{
40
case
SVGToken::StdDeviation
:
41
{
42
SvgNumber
aNum;
43
44
if
(
readSingleNumber
(aContent, aNum))
45
{
46
if
(aNum.
isPositive
())
47
{
48
maStdDeviation
= aNum;
49
}
50
}
51
break
;
52
}
53
default
:
54
{
55
break
;
56
}
57
}
58
}
59
60
void
SvgFeGaussianBlurNode::apply
(
drawinglayer::primitive2d::Primitive2DContainer
& rTarget)
const
61
{
62
const
drawinglayer::primitive2d::Primitive2DReference
xRef(
63
new
drawinglayer::primitive2d::SoftEdgePrimitive2D
(
maStdDeviation
.
getNumber
(),
64
std::move(
rTarget
)));
65
66
rTarget
=
drawinglayer::primitive2d::Primitive2DContainer
{ xRef };
67
}
68
69
}
// end of namespace svgio::svgreader
70
71
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
drawinglayer::primitive2d::Primitive2DContainer
drawinglayer::primitive2d::SoftEdgePrimitive2D
rtl::Reference
svgio::svgreader::SvgDocument
Definition:
svgdocument.hxx:32
svgio::svgreader::SvgFeGaussianBlurNode::SvgFeGaussianBlurNode
SvgFeGaussianBlurNode(SvgDocument &rDocument, SvgNode *pParent)
Definition:
svgfegaussianblurnode.cxx:26
svgio::svgreader::SvgFeGaussianBlurNode::parseAttribute
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
Definition:
svgfegaussianblurnode.cxx:34
svgio::svgreader::SvgFeGaussianBlurNode::~SvgFeGaussianBlurNode
virtual ~SvgFeGaussianBlurNode() override
Definition:
svgfegaussianblurnode.cxx:32
svgio::svgreader::SvgFeGaussianBlurNode::apply
void apply(drawinglayer::primitive2d::Primitive2DContainer &rTarget) const override
Definition:
svgfegaussianblurnode.cxx:60
svgio::svgreader::SvgFeGaussianBlurNode::maStdDeviation
SvgNumber maStdDeviation
Definition:
svgfegaussianblurnode.hxx:31
svgio::svgreader::SvgFilterNode
Definition:
svgfilternode.hxx:29
svgio::svgreader::SvgNode
Definition:
svgnode.hxx:81
svgio::svgreader::SvgNumber
Definition:
SvgNumber.hxx:63
svgio::svgreader::SvgNumber::isPositive
bool isPositive() const
Definition:
SvgNumber.hxx:100
svgio::svgreader::SvgNumber::getNumber
double getNumber() const
Definition:
SvgNumber.hxx:85
rTarget
FilterGroup & rTarget
svgio::svgreader
Definition:
svganode.cxx:23
svgio::svgreader::readSingleNumber
bool readSingleNumber(std::u16string_view rCandidate, SvgNumber &aNum)
Definition:
svgtools.cxx:1076
svgio::svgreader::SVGToken
SVGToken
Definition:
svgtoken.hxx:28
svgio::svgreader::SVGToken::StdDeviation
@ StdDeviation
svgio::svgreader::SVGToken::FeGaussianBlur
@ FeGaussianBlur
softedgeprimitive2d.hxx
string_view.hxx
svgfegaussianblurnode.hxx
Generated on Sun Jul 30 2023 04:26:41 for LibreOffice Module svgio (master) by
1.9.3