All Projects → stkent → Polygondrawingutil

stkent / Polygondrawingutil

Licence: other
A compact Android utility for constructing and drawing rounded regular polygons.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Polygondrawingutil

Smiley Rating
A custom android Rating view with Interactive Smiles 😄
Stars: ✭ 103 (-87.2%)
Mutual labels:  android-view, android-ui
Opencv Cheat Sheet
Opencv cheat sheet for C++
Stars: ✭ 30 (-96.27%)
Mutual labels:  drawing, geometry
Anychart Android
AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
Stars: ✭ 1,762 (+118.88%)
Mutual labels:  android-view, android-ui
Xcdanmuview
Android弹幕效果View-支持左右两个方向
Stars: ✭ 28 (-96.52%)
Mutual labels:  android-view, android-ui
ludigraphix.github.io
Documentation for Ludigraphix
Stars: ✭ 21 (-97.39%)
Mutual labels:  drawing, geometry
Krumbsview
🍞 The ultimate breadcrumbs view for Android!
Stars: ✭ 170 (-78.88%)
Mutual labels:  android-view, android-ui
Android library
android_library
Stars: ✭ 170 (-78.88%)
Mutual labels:  android-view, android-ui
Maker.js
📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
Stars: ✭ 1,185 (+47.2%)
Mutual labels:  drawing, geometry
vec
Vector graphics software to generate HPGL output to drive a plotter
Stars: ✭ 19 (-97.64%)
Mutual labels:  drawing, geometry
andColorPicker
Color picker library for Android
Stars: ✭ 233 (-71.06%)
Mutual labels:  android-ui, android-view
Avatar View
Avatar ImageView with user's name first letter Drawable placeholder
Stars: ✭ 309 (-61.61%)
Mutual labels:  android-view, android-ui
SignatureView
【Android View】:好用的Android电子签名板,能保存所签名的图片
Stars: ✭ 89 (-88.94%)
Mutual labels:  android-ui, android-view
Proswipebutton
A swipe button for Android with a circular progress bar for async operations
Stars: ✭ 319 (-60.37%)
Mutual labels:  android-view, android-ui
Music Player Go
🎶🎼 Very slim music player 👨‍🎤 100% made in Italy 🍕🌳🌞🍝🌄
Stars: ✭ 654 (-18.76%)
Mutual labels:  android-ui
Motiontoast
🌈 A Beautiful Motion Toast Library for Kotlin Android
Stars: ✭ 767 (-4.72%)
Mutual labels:  android-ui
Osmbuildings
3d building geometry viewer based on OpenStreetMap data
Stars: ✭ 652 (-19.01%)
Mutual labels:  geometry
Theiasfm
An open source library for multiview geometry and structure from motion
Stars: ✭ 647 (-19.63%)
Mutual labels:  geometry
Slidetoact
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
Stars: ✭ 783 (-2.73%)
Mutual labels:  android-ui
Geometry
geometry is a minimal, fully customizable and composable zsh prompt theme
Stars: ✭ 770 (-4.35%)
Mutual labels:  geometry
Jspaint
🎨 Classic MS Paint, REVIVED + ✨Extras
Stars: ✭ 5,972 (+641.86%)
Mutual labels:  drawing

PolygonDrawingUtil

Download Android Arsenal

A compact Android utility for constructing and drawing rounded regular polygons.

Consumers can specify:

  • number of sides (≥ 3);
  • center coordinates;
  • outer radius (center to vertex);
  • corner rounding radius;
  • polygon rotation;
  • (optional) fill/stroke Paint;
  • (optional) target Path instance.

Demo

This video was captured using the sample application in this repository. It provides convenient controls for exploring PolygonDrawingUtil's capabilities.

Getting Started

  1. Specify PolygonDrawingUtil as a dependency in your build.gradle file:

    dependencies {
      implementation "com.stkent:polygondrawingutil:1.2.0"
    }
    
  2. Create a new PolygonDrawingUtil instance and assign it to a property in your custom view class:

    private val polygonDrawingUtil = PolygonDrawingUtil()
    
  3. Call polygonDrawUtil.drawPolygon in your onDraw method:

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
    
        polygonDrawingUtil.drawPolygon(
            canvas,
            numberOfSides,
            centerX,
            centerY,
            polygonRadius,
            cornerRadius,
            rotation,
            polygonPaint
        )
    }
    

    Alternately, you can supply your own Path instance and ask PolygonDrawingUtil to fill it with a polygon:

    private val myPath = Path()
    
    polygonDrawingUtil.constructPolygonPath(
        myPath,
        numberOfSides,
        centerX,
        centerY,
        polygonRadius,
        cornerRadius,
        rotation
    )
    

    This allows you to perform post-processing on the Path before drawing to a Canvas.

License

Copyright 2019 Stuart Kent

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].