• Stars
    star
    568
  • Rank 78,502 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 12 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fork of svg-android +SVN history +Maven +more

Status: Unmaintained. Discontinued.

This project is no longer being developed or maintained.

_

This is forked from the awesome but unmaintained: http://code.google.com/p/svg-android/

Changes

  • Mavenised.
  • Added SVGBuilder to allow easy specification of SVG parsing & rendering options.
  • ColorFilters can now be applied.
  • Layer opacity and hiding is now supported.
  • This library now works with Robolectric.
  • SVG viewBox attribute is now handled.
  • Numbers with exponents are handled.
  • SVGZ (gzipped svg) auto-detected and supported. (Thank @josefpavlik & @mstevens83)
  • Performance enhancements.
  • Has most community patches applied. Great work to josefpavlik and mrn

Maven

Add this to your Android project's pom.xml:

<dependency>
  <groupId>com.github.japgolly.android</groupId>
  <artifactId>svg-android</artifactId>
	<version>2.0.6</version>
</dependency>

Usage

Firstly, store your SVGs in res/raw or assets.

// Load and parse a SVG
SVG svg = new SVGBuilder()
            .readFromResource(getResources(), R.raw.someSvgResource) // if svg in res/raw
            .readFromAsset(getAssets(), "somePicture.svg")           // if svg in assets
            // .setWhiteMode(true) // draw fills in white, doesn't draw strokes
            // .setColorSwap(0xFF008800, 0xFF33AAFF) // swap a single colour
            // .setColorFilter(filter) // run through a colour filter
            // .set[Stroke|Fill]ColorFilter(filter) // apply a colour filter to only the stroke or fill
            .build();

// Draw onto a canvas
canvas.drawPicture(svg.getPicture());

// Turn into a drawable
Drawable drawable = svg.createDrawable();
// drawable.draw(canvas);
// imageView.setImageDrawable(drawable);

More Repositories

1

scalajs-react

Facebook's React on Scala.JS
Scala
1,644
star
2

scalacss

Super type-safe CSS for Scala and Scala.JS.
Scala
339
star
3

scala-graal

Make usage of Graal features easy and safe from Scala. Also features Scala-based React SSR.
Scala
194
star
4

nyaya

Random Data Generation and/or Property Testing in Scala & Scala.JS.
Scala
185
star
5

test-state

Scala Test-State.
Scala
141
star
6

clear-config

Scala FP configuration library with a focus on runtime clarity
Scala
140
star
7

scalajs-benchmark

Benchmarks: write in Scala or JS, run in your browser. Live demo:
Scala
72
star
8

univeq

Safer universal equivalence (==) for Scala.
Scala
59
star
9

learning

Scala
46
star
10

setup-everything-scala

GitHub Action to prepare the environment for Scala & Scala.JS dev and testing
Scala
40
star
11

mr.boilerplate

Online app to generate Scala boilerplate
Scala
33
star
12

microlibs-scala

Scala
26
star
13

tla2json

Convert TLA+ output (and values) into JSON
Scala
24
star
14

webtamp

Asset bundler. Companion to bundlers like Webpack.
TypeScript
20
star
15

webapp-util

Scala Webapp Utilities
Scala
17
star
16

scala-restructure

Scala
9
star
17

misc

4
star
18

archlinux-packages

Shell
2
star
19

setup-scalajs

GitHub Action to prepare the environment for Scala.JS dev and testing
JavaScript
2
star
20

rubyprof-test

Ruby
1
star
21

setup-scala-util

GitHub Action to add Scala utilities to the PATH
Scala
1
star
22

ruby-corvid

Ruby
1
star
23

astacus

Ruby
1
star
24

autotag2

Years-old app to tag MP3s.
Ruby
1
star
25

android-test-utils

Java
1
star
26

text_to_diagram

Generate software diagrams (ERDs, DFDs, etc) using text files, rather than spending hours combating visual tools.
Ruby
1
star
27

ruby-golly-utils

Ruby
1
star