{"id":13645514,"url":"https://github.com/stkent/PolygonDrawingUtil","last_synced_at":"2025-04-21T14:31:27.005Z","repository":{"id":91598069,"uuid":"88362316","full_name":"stkent/PolygonDrawingUtil","owner":"stkent","description":"A compact Android utility for constructing and drawing rounded regular polygons.","archived":true,"fork":false,"pushed_at":"2019-08-26T08:57:09.000Z","size":1825,"stargazers_count":823,"open_issues_count":1,"forks_count":96,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-09T18:42:52.954Z","etag":null,"topics":["android","android-ui","android-view","drawing","geometry","polygons"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stkent.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-04-15T17:15:35.000Z","updated_at":"2024-08-21T05:53:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"cec3529f-2d2d-4c7c-a9c1-1c53e2ef3729","html_url":"https://github.com/stkent/PolygonDrawingUtil","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkent%2FPolygonDrawingUtil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkent%2FPolygonDrawingUtil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkent%2FPolygonDrawingUtil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stkent%2FPolygonDrawingUtil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stkent","download_url":"https://codeload.github.com/stkent/PolygonDrawingUtil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070173,"owners_count":21369839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-ui","android-view","drawing","geometry","polygons"],"created_at":"2024-08-02T01:02:36.267Z","updated_at":"2025-04-21T14:31:26.394Z","avatar_url":"https://github.com/stkent.png","language":"Java","funding_links":[],"categories":["其他"],"sub_categories":[],"readme":"# PolygonDrawingUtil\n\n [![Download](https://api.bintray.com/packages/stkent/android-libraries/PolygonDrawingUtil/images/download.svg)](https://bintray.com/stkent/android-libraries/PolygonDrawingUtil/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PolygonDrawingUtil-green.svg?style=flat)](https://android-arsenal.com/details/1/5597)\n\nA compact Android utility for constructing and drawing rounded regular polygons.\n\nConsumers can specify:\n\n- number of sides (≥ 3);\n- center coordinates;\n- outer radius (center to vertex);\n- corner rounding radius;\n- polygon rotation;\n- (optional) fill/stroke [`Paint`](https://developer.android.com/reference/android/graphics/Paint.html);\n- (optional) target [`Path`](https://developer.android.com/reference/android/graphics/Path) instance.\n\n# Demo\n\n![](assets/demo.gif)\n\nThis video was captured using the sample application in this repository. It provides convenient controls for exploring `PolygonDrawingUtil`'s capabilities.\n\n# Getting Started\n\n1. Specify PolygonDrawingUtil as a dependency in your `build.gradle` file:\n\n    ```groovy\n    dependencies {\n      implementation \"com.stkent:polygondrawingutil:1.2.0\"\n    }\n    ```\n\n2. Create a new `PolygonDrawingUtil` instance and assign it to a property in your custom view class:\n\n    ```kotlin\n    private val polygonDrawingUtil = PolygonDrawingUtil()\n    ```\n\n3. Call `polygonDrawUtil.drawPolygon` in your `onDraw` method:\n\n    ```kotlin\n    override fun onDraw(canvas: Canvas) {\n        super.onDraw(canvas)\n\n        polygonDrawingUtil.drawPolygon(\n            canvas,\n            numberOfSides,\n            centerX,\n            centerY,\n            polygonRadius,\n            cornerRadius,\n            rotation,\n            polygonPaint\n        )\n    }\n    ```\n\n    Alternately, you can supply your own `Path` instance and ask `PolygonDrawingUtil` to fill it with a polygon:\n\n    ```kotlin\n    private val myPath = Path()\n\n    polygonDrawingUtil.constructPolygonPath(\n        myPath,\n        numberOfSides,\n        centerX,\n        centerY,\n        polygonRadius,\n        cornerRadius,\n        rotation\n    )\n    ```\n\n    This allows you to perform post-processing on the `Path` before drawing to a `Canvas`.\n\n# License\n\n\tCopyright 2019 Stuart Kent\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS,\n\tWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\tSee the License for the specific language governing permissions and\n\tlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstkent%2FPolygonDrawingUtil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstkent%2FPolygonDrawingUtil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstkent%2FPolygonDrawingUtil/lists"}