Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scalable images
 and smaller APK,
 that’s Vecto...

Scalable images
 and smaller APK,
 that’s VectorDrawable

Did you know you can get rid of lots of multiple PNGs in your APK? You can do that with Vector Drawables

Jorge E. Hernández

June 07, 2017
Tweet

More Decks by Jorge E. Hernández

Other Decks in Programming

Transcript

  1. <a> <altGlyph> <altGlyphDef> <altGlyphItem> <animate> <animateMotion> <animateTransform> <circle> <clipPath> <color-profile>

    <cursor> <defs> <desc> <ellipse> <feBlend> feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB
 feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject <g> glyph glyphRef>
 hkern <image> <line>
 <linearGradient> <marker> <mask> metadata missing-glyph mpath <path> <pattern> <polygon> <polyline> <radialGradient> <rect> script set <stop> style <svg> switch symbol <text> textPath title <tref> <tspan> <use> view vkern
  2. M x,y
 Start a new path or subpath by moving

    to (x,y) L x,y
 Draw a line to (x,y) C x1,y1 x2,y2 x,y
 Draw a cubic bezier curve to (x,y) using control points (x1,y1) and (x2,y2). 
 Z
 Close the path by drawing a line back to the beginning of the current subpath.
  3. <path
 android:fillColor="#DCDEE0"
 android:pathData="
 M 9.5 5
 C 9.5 7.5 7.5

    9.5 5 9.5
 C 2.5 9.5 0.5 7.5 0.5 4.9
 C 0.5 2.5 2.5 0.5 5 0.5
 C 7.5 0.5 9.5 2.5 9.5 5 "/>
  4. <path
 android:fillColor="#edb306"
 android:pathData="
 M 100,50
 C 100,77.61 77.61,100 50,100
 C

    22.39,100 0,77.61 0,50
 C 0,22.39 22.39,0 50,0
 C 77.61,0 100,22.39 100,50 Z"/>
  5. <path
 android:fillColor="#eec748"
 android:pathData="
 M 85,50
 C 85,69.33 69.33,85 50,85
 C

    30.67,85 15,69.33 15,50
 C 15,30.67 30.67,15 50,15
 C 69.33,15 85,30.67 85,50
 Z "/>
  6. <path
 android:fillColor="#f0f1f2"
 android:pathData="M 70,50
 C 70,61.05 61.05,70 50,70
 C 38.96,70

    30,61.05 30,50
 C 30,38.95 38.96,30 50,30
 C 61.05,30 70,38.95 70,50
 Z"/>
  7. How to create Vector Drawables? CorelDRAW Corel ConceptDraw PRO GNOME

    LibreOffice The Document Foundation Apache OpenOffice Apache Software Foundation Serif DrawPlus Serif Europe Edraw Max Embroidermodder Macromedia FreeHand Adobe Systems Adobe Illustrator Adobe Systems Inkscape OmniGraffle PhotoLine Sketch SketchUp Trimble Navigation SVG-edit Synfig Microsoft Visio Xara Photo & Graphic Designer Xara
  8. How to create Vector Drawables? convert file.png file.pnm # PNG

    to PNM potrace file.pnm -s -o file.svg # PNM to SVG