An open API service indexing awesome lists of open source software.

https://github.com/m1ga/ti.svg


https://github.com/m1ga/ti.svg

android svg titanium-mobile titanium-module

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

:warning: currently not working - check https://fromzerotoapp.com/?s=svg for alternatives :warning:

# Titanium SDK - SVG Module (Android)

Buy Me A Coke donate button

Basic module for loading SVG files on Android using Sharp (https://github.com/Pixplicity/sharp).

:warning: currently not working - check https://fromzerotoapp.com/?s=svg for alternatives :warning:

## Requirements

* Titanium SDK 9+

## Example

tiapp.xml
```xml

ti.svg

```

Classic version:
```javascript
const Svg = require("ti.svg");

var win = Ti.UI.createWindow({backgroundColor: "#fff"});

var svg = Svg.createSvgView({
image: "/test.svg",
width: 200,
height: 200,
borderColor: "#000",
borderWidth: 1
})
win.add(svg);
win.open();
```

Alloy version:
```xml

```
**Keep in mind**

The image will be stretched into the view. So set the correct height/width!

## Hyperloop version

You can **use Hyperloop instead of this module** to load an SVG like this:

build.gradle
```
dependencies {
implementation 'com.pixplicity.sharp:library:1.1.2'
}
```
index.js
```javascript
import Activity from 'android.app.Activity';
import Sharp from "com.pixplicity.sharp.Sharp";

const activity = new Activity(Ti.Android.currentActivity);
const Context = activity.getApplicationContext();
const AssetManager = Context.getAssets();

function onClickShow(e) {
var fname = "/images/test.svg";
Sharp.loadAsset(AssetManager, "Resources" + fname).into($.img);
}

$.index.open();
```
index.xml
```xml




```

## Author

- Michael Gangolf ([@MichaelGangolf](https://twitter.com/MichaelGangolf) / [Web](http://migaweb.de))