示例#1
0
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGPolygon.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGPolygon::gAttributes[] = {
    SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule),
    SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule),
    SVG_ATTRIBUTE(points)
};

DEFINE_SVG_INFO(Polygon)

void SkSVGPolygon::addAttribute(SkSVGParser& parser, int attrIndex, 
        const char* attrValue, size_t attrLength) {
    INHERITED::addAttribute(parser, attrIndex, attrValue, attrLength);
}

void SkSVGPolygon::translate(SkSVGParser& parser, bool defState) {
    parser._startElement("polygon");
    SkSVGElement::translate(parser, defState);
    SVG_ADD_ATTRIBUTE(points);
    if (f_fillRule.size() > 0) 
        parser._addAttribute("fillType", f_fillRule.equals("evenodd") ? "evenOdd" : "winding");
示例#2
0
** Copyright 2006, Google Inc.
**
** Licensed 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 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGStop.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGStop::gAttributes[] = {
    SVG_ATTRIBUTE(offset)
};

DEFINE_SVG_INFO(Stop)

void SkSVGStop::translate(SkSVGParser& parser, bool defState) {
    parser._startElement("color");
    INHERITED::translate(parser, defState);
    parser._addAttribute("color", parser.getPaintLast(SkSVGPaint::kStopColor));
    parser._endElement();
}
示例#3
0
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGRadialGradient.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGRadialGradient::gAttributes[] = {
    SVG_ATTRIBUTE(cx),
    SVG_ATTRIBUTE(cy),
    SVG_ATTRIBUTE(fx),
    SVG_ATTRIBUTE(fy),
    SVG_ATTRIBUTE(gradientTransform),
    SVG_ATTRIBUTE(gradientUnits),
    SVG_ATTRIBUTE(r)
};

DEFINE_SVG_INFO(RadialGradient)

void SkSVGRadialGradient::translate(SkSVGParser& parser, bool defState) {
    if (fMatrixID.size() == 0)
        parser.translateMatrix(f_gradientTransform, &fMatrixID);
    parser._startElement("radialGradient");
    if (fMatrixID.size() > 0)
示例#4
0
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "SkSVGMask.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGMask::gAttributes[] = {
    SVG_ATTRIBUTE(height),
    SVG_ATTRIBUTE(maskUnits),
    SVG_ATTRIBUTE(width),
    SVG_ATTRIBUTE(x),
    SVG_ATTRIBUTE(y)
};

DEFINE_SVG_INFO(Mask)

bool SkSVGMask::isDef() {
    return false;
}

bool SkSVGMask::isNotDef() {
    return false;
}

void SkSVGMask::translate(SkSVGParser& parser, bool defState) {
示例#5
0
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGSVG.h"
#include "SkParse.h"
#include "SkRect.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGSVG::gAttributes[] = {
    SVG_LITERAL_ATTRIBUTE(enable-background, f_enable_background),
    SVG_ATTRIBUTE(height),
    SVG_ATTRIBUTE(overflow),
    SVG_ATTRIBUTE(width),
    SVG_ATTRIBUTE(version),
    SVG_ATTRIBUTE(viewBox),
    SVG_LITERAL_ATTRIBUTE(xml:space, f_xml_space),
    SVG_ATTRIBUTE(xmlns),
    SVG_LITERAL_ATTRIBUTE(xmlns:xlink, f_xml_xlink)
};

DEFINE_SVG_INFO(SVG)


bool SkSVGSVG::isFlushable() {
    return false;
}
示例#6
0
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGUse.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGUse::gAttributes[] = {
    SVG_ATTRIBUTE(height),
    SVG_ATTRIBUTE(width),
    SVG_ATTRIBUTE(x),
    SVG_LITERAL_ATTRIBUTE(xlink:href, f_xlink_href),
    SVG_ATTRIBUTE(y)
};

DEFINE_SVG_INFO(Use)

void SkSVGUse::translate(SkSVGParser& parser, bool defState) {
    INHERITED::translate(parser, defState);
    parser._startElement("add");
    const char* start = strchr(f_xlink_href.c_str(), '#') + 1;
    SkASSERT(start);
    parser._addAttributeLen("use", start, strlen(start) - 1);
    parser._endElement();   // clip
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGLinearGradient.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGLinearGradient::gAttributes[] = {
    SVG_ATTRIBUTE(gradientTransform),
    SVG_ATTRIBUTE(gradientUnits),
    SVG_ATTRIBUTE(x1),
    SVG_ATTRIBUTE(x2),
    SVG_ATTRIBUTE(y1),
    SVG_ATTRIBUTE(y2)
};

DEFINE_SVG_INFO(LinearGradient)

void SkSVGLinearGradient::translate(SkSVGParser& parser, bool defState) {
    if (fMatrixID.size() == 0)
        parser.translateMatrix(f_gradientTransform, &fMatrixID);
    parser._startElement("linearGradient");
    if (fMatrixID.size() > 0)
        parser._addAttribute("matrix", fMatrixID);
示例#8
0
**
** Licensed 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
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

#include "SkSVGFilter.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGFilter::gAttributes[] = {
    SVG_ATTRIBUTE(filterUnits),
    SVG_ATTRIBUTE(height),
    SVG_ATTRIBUTE(width),
    SVG_ATTRIBUTE(x),
    SVG_ATTRIBUTE(y)
};

DEFINE_SVG_INFO(Filter)

void SkSVGFilter::translate(SkSVGParser& parser, bool defState) {
//  INHERITED::translate(parser, defState);
}
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "SkSVGPaintState.h"
#include "SkSVGElements.h"
#include "SkSVGParser.h"
#include "SkParse.h"

SkSVGAttribute SkSVGPaint::gAttributes[] = {
    SVG_LITERAL_ATTRIBUTE(clip-path, f_clipPath),
    SVG_LITERAL_ATTRIBUTE(clip-rule, f_clipRule),
    SVG_LITERAL_ATTRIBUTE(enable-background, f_enableBackground),
    SVG_ATTRIBUTE(fill),
    SVG_LITERAL_ATTRIBUTE(fill-rule, f_fillRule),
    SVG_ATTRIBUTE(filter),
    SVG_LITERAL_ATTRIBUTE(font-family, f_fontFamily),
    SVG_LITERAL_ATTRIBUTE(font-size, f_fontSize),
    SVG_LITERAL_ATTRIBUTE(letter-spacing, f_letterSpacing),
    SVG_ATTRIBUTE(mask),
    SVG_ATTRIBUTE(opacity),
    SVG_LITERAL_ATTRIBUTE(stop-color, f_stopColor),
    SVG_LITERAL_ATTRIBUTE(stop-opacity, f_stopOpacity),
    SVG_ATTRIBUTE(stroke),
    SVG_LITERAL_ATTRIBUTE(stroke-dasharray, f_strokeDasharray),
    SVG_LITERAL_ATTRIBUTE(stroke-linecap, f_strokeLinecap),
    SVG_LITERAL_ATTRIBUTE(stroke-linejoin, f_strokeLinejoin),
    SVG_LITERAL_ATTRIBUTE(stroke-miterlimit, f_strokeMiterlimit),
    SVG_LITERAL_ATTRIBUTE(stroke-width, f_strokeWidth),
示例#10
0
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "SkSVGPath.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGPath::gAttributes[] = {
    SVG_ATTRIBUTE(d)
};

DEFINE_SVG_INFO(Path)

void SkSVGPath::translate(SkSVGParser& parser, bool defState) {
    parser._startElement("path");
    INHERITED::translate(parser, defState);
    bool hasMultiplePaths = false;
    const char* firstZ = strchr(f_d.c_str(), 'z');
    if (firstZ != nullptr) {
        firstZ++; // skip over 'z'
        while (*firstZ == ' ')
            firstZ++;
        hasMultiplePaths = *firstZ != '\0';
    }
    if (hasMultiplePaths) {
        SkString& fillRule = parser.getPaintLast(SkSVGPaint::kFillRule);
示例#11
0
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "SkSVGFeColorMatrix.h"
#include "SkSVGParser.h"

const SkSVGAttribute SkSVGFeColorMatrix::gAttributes[] = {
    SVG_LITERAL_ATTRIBUTE(color-interpolation-filters, f_color_interpolation_filters),
    SVG_ATTRIBUTE(result),
    SVG_ATTRIBUTE(type),
    SVG_ATTRIBUTE(values)
};

DEFINE_SVG_INFO(FeColorMatrix)

void SkSVGFeColorMatrix::translate(SkSVGParser& parser, bool defState) {
    INHERITED::translate(parser, defState);
}
示例#12
0
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include "SkSVGEllipse.h"
#include "SkSVGParser.h"
#include "SkParse.h"
#include <stdio.h>

const SkSVGAttribute SkSVGEllipse::gAttributes[] = {
    SVG_ATTRIBUTE(cx),
    SVG_ATTRIBUTE(cy),
    SVG_ATTRIBUTE(rx),
    SVG_ATTRIBUTE(ry)
};

DEFINE_SVG_INFO(Ellipse)

void SkSVGEllipse::translate(SkSVGParser& parser, bool defState) {
    parser._startElement("oval");
    INHERITED::translate(parser, defState);
    SkScalar cx, cy, rx, ry;
    SkParse::FindScalar(f_cx.c_str(), &cx);
    SkParse::FindScalar(f_cy.c_str(), &cy);
    SkParse::FindScalar(f_rx.c_str(), &rx);
    SkParse::FindScalar(f_ry.c_str(), &ry);