Create a view from an svg file (expose the androidsvg-1.2.1 lib and the SVGKit 2.X for IOS lib).
Makefile Objective-C Python Other
Pull request Compare This branch is 4 commits ahead of GeraudBourdin:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
android
assets
documentation
example
iphone
.classpath.example
.gitattributes
.gitignore
.project
CHANGELOG.txt
LICENSE
LICENSE.txt
README.md
manifest

README.md

Ti.SvgView Module

Description

This module simply create a view from an svg file by exposing the androidsvg-1.2.1 lib and the SVGKit 2.X for IOS lib.

Quick Start

Get it gitTio

Download the latest distribution ZIP-file and consult the Titanium Documentation on how install it, or simply use the gitTio CLI:

$ gittio install com.geraudbourdin.svgview

Usage :

var svgView = require('com.geraudbourdin.svgview');
var svg = svgView.createView({
    image: "0.svg",
    width: '350',
    height: '350',
    top: 0,
    left: 0,
    backgroundColor:'pink'
});

$.container.add(svg);

You can change your file dynamically with the setImage(path) function.

var image = 'android.svg';
svg.setImage(image);

Or simply use it to set an image to a button :

var svg = svgView.createView({
    image: "android.svg",
    width: '50',
    height: '50',
    top: 0,
    left: 0,
    backgroundColor:'pink'
});

var svgImage = svg.toImage().media;
$.buttonSvg.setImage(svgImage);

Building module

Before importing to the Appcelerator Studio or/and building module you must create this files from corresponding examples and fill their contents to your environment paths:

  • android/build.properties
  • .classpath

    Copy/paste and remove .example from file name.

License

The MIT License (MIT)

Copyright © 2015 Géraud Bourdin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.