• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

japgolly/svg-android: Fork of svg-android +SVN history +Maven +more

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

japgolly/svg-android

开源软件地址(OpenSource Url):

https://github.com/japgolly/svg-android

开源编程语言(OpenSource Language):

Java 98.1%

开源软件介绍(OpenSource Introduction):

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);



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap