• Stars
    star
    188
  • Rank 205,563 (Top 5 %)
  • Language
    Java
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 9 years ago

Reviews

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

Repository Details

Static factory methods for fancy Path objects

Artiste

Artiste is a collection of static methods for creating Path objects initialized with different shapes.

Add as a dependency

Artiste is on jCenter.

repositories {
    jcenter()
}
dependencies {
    compile 'me.mattlogan.artiste:artiste:4.0.0'
}

Overview

The Paths class contains the entirety of the public API for this library. It contains three static factory methods, including:

  1. One method for creating a regular convex polygon.
  2. One method for creating a regular star polygon.
  3. One method for creating a circle.

The API

public static Path regularConvexPolygon(int left, int top, int right, int bottom, int numSides, float rotationDegrees)

Creates a regular convex polygon Path.

  • Parameters:
    • left — Left bound
    • top — Top bound
    • right — Right bound
    • bottom — Bottom bound
    • numSides — Number of sides
    • rotationDegrees — Degrees to rotate polygon
  • Returns: A Path corresponding to a regular convex polygon.

public static Path regularStarPolygon(int left, int top, int right, int bottom, int numPoints, int density, float rotationDegrees, boolean outline)

Creates a regular star polygon Path.

  • Parameters:
    • left — Left bound
    • top — Top bound
    • right — Right bound
    • bottom — Bottom bound
    • numPoints — Number of points on star
    • density — Density of the star polygon (the number of vertices, or points, to skip when drawing a line connecting two vertices.)
    • rotationDegrees — Number of degrees to rotate star polygon
    • outline — True if only the star's outline should be drawn. If false, complete lines will be drawn connecting the star's vertices.
  • Returns: A Path corresponding to a regular star polygon.

public static Path circle(int left, int top, int right, int bottom)

Creates a circle Path.

  • Parameters:
    • left — Left bound
    • top — Top bound
    • right — Right bound
    • bottom — Bottom bound
  • Returns: A Path corresponding to a circle.

Tests

This library contains instrumentation tests in the directory /library/src/androidTest/.

It's hard to be 100% sure, even with these tests, that the static factory methods in Paths are returning Path objects initialized with the correct shape. Some of these tests are a bit more implicit -- for example, making sure a pentagon has a larger perimeter than a square. Others just check for known values -- for example, that the perimeter of a square inscribed inside a circle with diameter 100 is 282.84. Finally, some tests check for exceptions that should be thrown for invalid arguments.

In addition to the library module, there's also an example module with a small demo app. This is a quick way to verify that the library works as described for at least a few of the more common shapes you might encounter. The picture at the top of this readme is a cropped screenshot from this example app.

License

The MIT License (MIT)

Copyright (c) 2014 Matthew Logan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

Pancakes

A View-based navigation stack for Android
Java
234
star
2

RhymeCity

Sample Android app for aspiring lyricists
Java
139
star
3

auto-value-firebase

AutoValue extension for creating Firebase Realtime Database objects
Java
102
star
4

CircleMenu

Deprecated -- material design is better
Java
34
star
5

Twenty-seven

Android Experiments: https://experiments.withgoogle.com/twenty-seven
Java
16
star
6

ParallaxListView

Android ListView with parallaxed header
Java
16
star
7

AndroidImageResizer

A Node.js + ImageMagick script for resizing images for Android apps
JavaScript
15
star
8

StravaFlow

Simple master-detail Android app using Strava API. Retrofit + Otto + ButterKnife.
Java
12
star
9

NDKTest

Trivial NDK example for Android Studio adapted from Gradle samples
Groovy
11
star
10

SurgePriceWidget

Android widget for getting current Uber surge prices at your location -- Uber API + Retrofit + Otto
Java
10
star
11

LocationTracker

Demo app for test doubles talk: https://www.youtube.com/watch?v=_pCwcdNtxog
Java
9
star
12

ImageSearch

Sample Android app -- Google Image Search API + Picasso + Retrofit + Otto
Java
8
star
13

push-to-talk-android

A small sample app for saving voice recordings to the cloud. ViewModel + LiveData + Firebase cloud storage + unidirectional data flow etc.
Kotlin
7
star
14

RxJavaImageSearch

Google Instant style image search Android app -- Retrofit + RxJava (w/ PublishSubject) + Picasso
Java
6
star
15

SelectableMapFragment

Android MapFragment with draggable overlay box
Java
6
star
16

XapiClient

Android client for the OpenStreetMap (OSM) Extended API (Xapi)
Java
2
star
17

ReverseDrawerLayout

Modified Android DrawerLayout -- sliding content view on drawer, navigation menu underneath (just like SlidingMenu)
Java
1
star