# android-shape-imageview
**Repository Path**: lywschxd/android-shape-imageview
## Basic Information
- **Project Name**: android-shape-imageview
- **Description**: Custom shaped android imageview components
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-02-25
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Shape Image View
[](https://travis-ci.org/siyamed/android-shape-imageview/)
[](https://maven-badges.herokuapp.com/maven-central/com.github.siyamed/android-shape-imageview)
Provides a set of custom shaped android imageview components, and a framework to define more shapes. Implements both **shader** and **bitmap mask** based image views.
[Shader]: http://developer.android.com/reference/android/graphics/BitmapShader.html
[Path.addPath]: http://developer.android.com/reference/android/graphics/Path.html#addPath(android.graphics.Path)
[Path]: http://developer.android.com/reference/android/graphics/Path.html
[xfermode]: http://developer.android.com/reference/android/graphics/Xfermode.html
[svg_location]: library/src/main/res/raw
[svg_rectangle]: http://www.w3schools.com/svg/svg_rect.asp
[svg_circle]: http://www.w3schools.com/svg/svg_circle.asp
[svg_ellipse]: http://www.w3schools.com/svg/svg_ellipse.asp
[svg_polygon]: http://www.w3schools.com/svg/svg_polygon.asp
[svg_path]: http://www.w3schools.com/svg/svg_path.asp
[svg_group]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
[svg_transformations]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform
[sample_app_play_store]: https://play.google.com/store/apps/details?id=com.github.siyamed.shapeimageview.sample
[youtube_video]: http://youtu.be/6fCkptmwxtQ
* [Shader][Shader] based one uses *canvas draw methods* and *[Path][Path]* class,
* Mask based one uses [xfermode][xfermode] to draw image on bitmaps defined by android shape XML's or resource bitmaps.
There are many projects online implementing such components, however one goal of this project is to provide a
performant/smooth scrolling **image view component framework** to define different shapes for imageviews.
**For use with recycling view such as ListView or GridView please use shader based implementations.**
[Sample app in play store][sample_app_play_store]
[Youtube video][youtube_video]
## How to use
Gradle dependency:
```Groovy
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
```
###Shader Based ImageView's
####BubbleImageView

```XML
```
Attributes:
* `siTriangleHeight` the height of the bubble pointer in dp
* `siArrowPosition` where to point the arrow, currently `left|right`
* `siSquare` set width and height to the minimum of the given values `true|false`
####RoundedImageView

```XML
```
Attributes:
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0
* `siRadius` corner radius in dp
* `siSquare` set width and height to the minimum of the given values `true|false`
####CircularImageView

```XML
```
Attributes:
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0
####ShapeImageView
This view has the capability to process a provided SVG file (for a limited set of SVG elements), build a
[Path][Path] object and draw it on the shader. The library includes SVG files defining a set of basic shapes and
ShapeImageView subclasses using those files. You can use whatever SVG you want to have a wonderful
and creatively shaped images in your application. The included SVG files are under [library/src/main/res/raw][svg_location]
| DiamondImageView | PentagonImageView | HexagonImageView |
| ------------------------------------------------------ | -------------------------------------------------------- | -------------------------------------------------------- |
|  |  |  |
| OctogonImageView | StarImageView | HeartImageView |
| ------------------------------------------------------ | -------------------------------------------------------- | ---------------------------------------------------- |
|  |  |  |
```XML
```
Attributes:
* `siBorderColor` border color
* `siBorderWidth` border width in dp
* `siBorderAlpha` alpha value of the border between 0.0-1.0
* `siStrokeCap` border stroke cap type `butt|round|square`
* `siStrokeJoin` border stroke join type `bevel|miter|round`
* `siSquare` set width and height to the minimum of the given values `true|false`
* `siShape` a reference to an SVG. This is used by ShapeImageView, not the subclasses of it.
SVG elements that are supported are: [rectangle][svg_rectangle], [circle][svg_circle],
[ellipse][svg_ellipse], [polygon][svg_polygon], [path][svg_path], [group][svg_group]. [Transformations][svg_transformations] on those elements are also supported.
The system converts an SVG file into a Path. For each element including the parent element `