{"id":13396291,"url":"https://github.com/lankton/android-anyshape","last_synced_at":"2025-03-13T22:31:57.750Z","repository":{"id":73774142,"uuid":"54545883","full_name":"lankton/android-anyshape","owner":"lankton","description":"a solution that can help developers display pictures in any shape. ","archived":false,"fork":false,"pushed_at":"2016-07-10T07:46:24.000Z","size":1542,"stargazers_count":193,"open_issues_count":3,"forks_count":29,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T18:17:02.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lankton.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-23T09:13:04.000Z","updated_at":"2024-02-23T01:19:57.000Z","dependencies_parsed_at":"2023-09-21T04:15:16.675Z","dependency_job_id":null,"html_url":"https://github.com/lankton/android-anyshape","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lankton%2Fandroid-anyshape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lankton%2Fandroid-anyshape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lankton%2Fandroid-anyshape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lankton%2Fandroid-anyshape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lankton","download_url":"https://codeload.github.com/lankton/android-anyshape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243494119,"owners_count":20299767,"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":[],"created_at":"2024-07-30T18:00:44.036Z","updated_at":"2025-03-13T22:31:57.743Z","avatar_url":"https://github.com/lankton.png","language":"Java","funding_links":[],"categories":["Index `(light-weight pages)`","Index"],"sub_categories":[],"readme":"\n[ ![Download](https://api.bintray.com/packages/lankton/maven/anyshape/images/download.svg) ](https://bintray.com/lankton/maven/anyshape/_latestVersion)\n\n# android-anyshape\n**With the solution, pictures can be displayed in any shape on Android platform.**\n\n## Effect\nThe left is the UI using normal ImageViews, and the right is UI using the AnyshapeImageViews  \n\u003cimg src=\"https://github.com/lankton/android-anyshape/blob/master/pictures/with_normal.jpg\" height=\"400px\"/\u003e\n\u003cimg src=\"https://github.com/lankton/android-anyshape/blob/master/pictures/with_mask_gif.gif\" height=\"400px\"/\u003e  \nAll we need to make are 3 mask PNGs like below (**the background must be transparent**):   \n\u003cimg src=\"https://github.com/lankton/android-anyshape/blob/master/pictures/singerstar_1.png\" height=\"100px\"/\u003e\n\u003cimg src=\"https://github.com/lankton/android-anyshape/blob/master/pictures/text_1.png\" height=\"100px\"/\u003e\n\u003cimg src=\"https://github.com/lankton/android-anyshape/blob/master/pictures/rings_1.png\" height=\"100px\"/\u003e\n\n## minSdkVersion\n11\n\n## Dependencies\n### latest version\nsee it as an icon in the beginning of the README file.\n### gradle\n```\ncompile 'cn.lankton:anyshape:latest version'\n```\n### maven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecn.lankton\u003c/groupId\u003e\n  \u003cartifactId\u003eanyshape\u003c/artifactId\u003e\n  \u003cversion\u003elatest version\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\nYou can use the AnyshapeImageView like below in your layout file:\n\n```xml\n\u003ccn.lankton.anyshape.AnyshapeImageView\n    android:layout_width=\"150dp\"\n    android:layout_height=\"150dp\"\n    android:layout_marginTop=\"20dp\"\n    android:src=\"@drawable/kumamon\"\n    app:anyshapeMask=\"@drawable/singlestar\"/\u003e\n```\nYou can use the attribue \"anyshapeMask\" to set the mask. AnyshapeImageView can get the path from the mask, by detecting the alpha value of every pixel.\n\nif you want to create a view with pure color , you can use the code like this:  \n\n```xml\n\u003ccn.lankton.anyshape.AnyshapeImageView\n    android:layout_width=\"210dp\"\n    android:layout_height=\"140dp\"\n    android:layout_marginTop=\"20dp\"\n    app:anyshapeBackColor=\"@android:color/holo_red_light\"\n    app:anyshapeMask=\"@drawable/rings\"/\u003e\n```\nIf you want to change the pure color **dynamically**, do like this:\n\n```java\nanyshapeImageView.setBackColor(Color.Green);\n```\n\n\n## summary\nThe code is not hard for anybody to understand. Just hope that it can provide some help or inspiration for you.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flankton%2Fandroid-anyshape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flankton%2Fandroid-anyshape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flankton%2Fandroid-anyshape/lists"}