# victor **Repository Path**: ccpengfh/victor ## Basic Information - **Project Name**: victor - **Description**: Java JPEG、PNG 分辨率(DPI)处理 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: dlew/svg2vector - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-09-10 - **Last Updated**: 2024-09-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README victor ====== *What's our vector, Victor? -Captain Oveur* Use SVGs as resources in Android! With this plugin, you can define source folders for SVGs and they will automatically be rasterized/included in your build without messing with your source code. Installation ------------ Add the following to your `build.gradle`: ```gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.trello:victor:0.2.0' } } apply plugin: 'com.android.application' // Make sure to apply this plugin *after* the Android plugin apply plugin: 'com.trello.victor' ``` Also, your Android Gradle plugin (`com.android.tools.build:gradle`) must be at least version 1.1.+ Usage ----- Victor adds the `svg` source set to the Android plugin. You can define where your SVG folders are in the same way you define any other source sets: ```gradle android { sourceSets { main { svg.srcDir 'src/main/svg' } } } ``` You can have multiple SVG folders for a variety of build types/product flavors; or you can just use 'main' to cover them all. Additional configuration can be done in the `victor` closure: ```gradle victor { // Any assets defined in relative terms needs a base DPI specified svgDpi = 72 // Do not generate these densities for SVG assets excludeDensities = [ 'ldpi', 'xxxhdpi' ] } ``` OSX Issues ---------- When using Android Studio on OSX, you might see this error: `Toolkit not found: apple.awt.CToolkit` This occurs because [Batik](http://xmlgraphics.apache.org/batik/), the SVG toolkit Victor uses, requires a working version of AWT. If this happens you should install and use [JDK 1.7](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) for your instance of Android Studio. For instructions how, consult the "Mac OS X" section of [this article](https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under). Known Issues ------------ - Android Studio doesn't recognize generated resources in XML, so autocomplete doesn't work and you get warnings (even though the code works fine). Generated resources should be fully supported in future versions of the Android gradle plugin. - Android Studio doesn't automatically rebuild if the SVG folder is modified (like it does with other resources). Therefore, if you add SVGs you will have to manually rebuild before they will be generated. Planned Features ---------------- - 9-patch support