/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
Color aColor( n, n, n );
aGradient.StartColor = static_cast<sal_Int32>( aColor );
} break; case XML_ELEMENT(DRAW, XML_END):
{
sal_Int32 aEndTransparency;
::sax::Converter::convertPercent( aEndTransparency, aIter.toView() );
void XMLTransGradientStyleExport::exportXML( const OUString& rStrName, const uno::Any& rValue )
{ // MCGR: We try to write the gradient so, that applications without multi-color gradient support // can render it as best as possible. // This is similar to XMLGradientStyleExport::exportXML(). For details see there. if( rStrName.isEmpty() ) return; if (!rValue.has<css::awt::Gradient2>() && !rValue.has<css::awt::Gradient>()) return;
// ctor writes start tag. End-tag is written by destructor at block end.
SvXMLElementExport rElem(rExport, XML_NAMESPACE_DRAW, XML_OPACITY, true, false);
// Write child elements <loext:opacity-stop> // Do not export in standard ODF 1.3 or older. if ((rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0) return; if (aGradient.GetColorStops().empty()) return;
double fPreviousOffset = 0.0; for (auto& aCandidate : aGradient.GetColorStops())
{ // Attribute svg:offset. Make sure offsets are increasing. double fOffset = std::clamp<double>(aCandidate.getStopOffset(), 0.0, 1.0); if (fOffset < fPreviousOffset)
fOffset = fPreviousOffset;
rExport.AddAttribute(XML_NAMESPACE_SVG, XML_OFFSET, OUString::number(fOffset));
fPreviousOffset = fOffset;
// Attribute svg:stop-opacity, data type zeroToOneDecimal double fOpacity = std::clamp<double>(1.0 - aCandidate.getStopColor().getRed(), 0.0, 1.0);
rExport.AddAttribute(XML_NAMESPACE_SVG, XML_STOP_OPACITY, OUString::number(fOpacity));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.