# ImageFilterView

Summary:[Ctors](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#pubctors)\|[Methods](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#inhmethods)  

# ImageFilterView

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The Constraint Layout support library has been superseded by the[AndroidX Constraint Layout library](https://developer.android.com/reference/androidx/constraintlayout/classes), which is part of[Jetpack](https://developer.android.com/jetpack). The`ImageFilterView`class has been superseded by[`androidx.constraintlayout.utils.widget.ImageFilterView`](https://developer.android.com/reference/androidx/constraintlayout/utils/widget/ImageFilterView). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX.

`
public


class
ImageFilterView
`  
`


``

extends AppCompatImageView


``


`

|---|---|--------------------------------------------------|
| java.lang.Object                                       |||
| ↳ | android.support.v7.widget.AppCompatImageView        ||
|   | ↳ | android.support.constraint.utils.ImageFilterView |

<br />

*** ** * ** ***

An ImageView that can display, combine and filter images.**Added in 2.0**

Subclass of ImageView to handle various common filtering operations

## ImageFilterViewattributes

|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| altSrc              | Provide and alternative image to the src image to allow cross fading                                                                                                       |
| saturation          | Sets the saturation of the image. 0 = grayscale, 1 = original, 2 = hyper saturated                                                                                         |
| brightness          | Sets the brightness of the image. 0 = black, 1 = original, 2 = twice as bright                                                                                             |
| warmth              | This adjust the apparent color temperature of the image. 1=neutral, 2=warm, .5=cold                                                                                        |
| contrast            | This sets the contrast. 1 = unchanged, 0 = gray, 2 = high contrast                                                                                                         |
| crossfade           | Set the current mix between the two images. 0=src 1= altSrc image                                                                                                          |
| round               | (id) call the TransitionListener with this trigger id                                                                                                                      |
| roundPercent \&nbs; | Set the corner radius of curvature as a fraction of the smaller side. For squares 1 will result in a circle                                                                |
| overlay             | Defines whether the alt image will be faded in on top of the original image or if it will be crossfaded with it. Default is true. Set to false for semitransparent objects |

<br />

## Summary

|                                                                                                   ### Public constructors                                                                                                   ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[ImageFilterView](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#ImageFilterView(Context))`(Context context) `                                                              |
| ` `[ImageFilterView](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#ImageFilterView(Context,%20AttributeSet))`(Context context, AttributeSet attrs) `                          |
| ` `[ImageFilterView](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#ImageFilterView(Context,%20AttributeSet,%20int))`(Context context, AttributeSet attrs, int defStyleAttr) ` |

|                                                                                                                 ### Public methods                                                                                                                  ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`  | ` `[draw](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#draw(Canvas))`(Canvas canvas) `                                                                                                        |
| ` float` | ` `[getBrightness](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getBrightness())`() ` Returns the currently applied brightness                                                                |
| ` float` | ` `[getContrast](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getContrast())`() ` Returns the currently applied contrast                                                                      |
| ` float` | ` `[getCrossfade](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getCrossfade())`() ` Returns the currently applied crossfade.                                                                  |
| ` float` | ` `[getRound](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getRound())`() ` Get the corner radius of curvature NaN = RoundPercent in effect.                                                  |
| ` float` | ` `[getRoundPercent](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getRoundPercent())`() ` Get the fractional corner radius of curvature.                                                      |
| ` float` | ` `[getSaturation](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getSaturation())`() ` Returns the currently applied saturation                                                                |
| ` float` | ` `[getWarmth](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#getWarmth())`() ` Returns the currently applied warmth                                                                            |
| ` void`  | ` `[setBrightness](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setBrightness(float))`(float brightness) ` sets the brightness of the image; 0 = black, 1 = original, 2 = twice as bright     |
| ` void`  | ` `[setContrast](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setContrast(float))`(float contrast) ` This sets the contrast.                                                                  |
| ` void`  | ` `[setCrossfade](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setCrossfade(float))`(float crossfade) ` Set the current mix between the two images that can be set on this view.              |
| ` void`  | ` `[setRound](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setRound(float))`(float round) ` Set the corner radius of curvature                                                                |
| ` void`  | ` `[setRoundPercent](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setRoundPercent(float))`(float round) ` Set the corner radius of curvature as a fraction of the smaller side.               |
| ` void`  | ` `[setSaturation](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setSaturation(float))`(float saturation) ` sets the saturation of the image; 0 = grayscale, 1 = original, 2 = hyper saturated |
| ` void`  | ` `[setWarmth](https://developer.android.com/reference/android/support/constraint/utils/ImageFilterView#setWarmth(float))`(float warmth) ` This makes the apparent color temperature of the image warmer or colder.                       |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### ImageFilterView

```
public ImageFilterView (Context context)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

### ImageFilterView

```
public ImageFilterView (Context context, 
                AttributeSet attrs)
```

<br />

<br />

|            Parameters            ||
|-----------|-----------------------|
| `context` | `Context` <br />      |
| `attrs`   | `AttributeSet` <br /> |

### ImageFilterView

```
public ImageFilterView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)
```

<br />

<br />

|              Parameters               ||
|----------------|-----------------------|
| `context`      | `Context` <br />      |
| `attrs`        | `AttributeSet` <br /> |
| `defStyleAttr` | `int` <br />          |

## Public methods

### draw

```
public void draw (Canvas canvas)
```

<br />

<br />

|        Parameters         ||
|----------|-----------------|
| `canvas` | `Canvas` <br /> |

### getBrightness

```
public float getBrightness ()
```

Returns the currently applied brightness

<br />

|                                 Returns                                 ||
|---------|----------------------------------------------------------------|
| `float` | brightness 0 = black, 1 = original, 2 = twice as bright <br /> |

### getContrast

```
public float getContrast ()
```

Returns the currently applied contrast

<br />

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | 1 = unchanged, 0 = gray, 2 = high contrast <br /> |

### getCrossfade

```
public float getCrossfade ()
```

Returns the currently applied crossfade.

<br />

|               Returns                ||
|---------|-----------------------------|
| `float` | a number from 0 to 1 <br /> |

### getRound

```
public float getRound ()
```

Get the corner radius of curvature NaN = RoundPercent in effect.

<br />

|               Returns               ||
|---------|----------------------------|
| `float` | Radius of curvature <br /> |

### getRoundPercent

```
public float getRoundPercent ()
```

Get the fractional corner radius of curvature.

<br />

|                                   Returns                                    ||
|---------|---------------------------------------------------------------------|
| `float` | Fractional radius of curvature with respect to smallest size <br /> |

### getSaturation

```
public float getSaturation ()
```

Returns the currently applied saturation

<br />

|                             Returns                              ||
|---------|---------------------------------------------------------|
| `float` | 0 = grayscale, 1 = original, 2 = hyper saturated <br /> |

### getWarmth

```
public float getWarmth ()
```

Returns the currently applied warmth

<br />

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | warmth 1 is neutral, 2 is warm, .5 is cold <br /> |

### setBrightness

```
public void setBrightness (float brightness)
```

sets the brightness of the image; 0 = black, 1 = original, 2 = twice as bright

<br />

### setContrast

```
public void setContrast (float contrast)
```

This sets the contrast. 1 = unchanged, 0 = gray, 2 = high contrast

<br />

### setCrossfade

```
public void setCrossfade (float crossfade)
```

Set the current mix between the two images that can be set on this view.

<br />

|                    Parameters                     ||
|-------------|--------------------------------------|
| `crossfade` | `float`: a number from 0 to 1 <br /> |

### setRound

```
public void setRound (float round)
```

Set the corner radius of curvature

<br />

|                                          Parameters                                           ||
|---------|--------------------------------------------------------------------------------------|
| `round` | `float`: the radius of curvature NaN = default meaning roundPercent in effect <br /> |

### setRoundPercent

```
public void setRoundPercent (float round)
```

Set the corner radius of curvature as a fraction of the smaller side. For squares 1 will result in a circle

<br />

|                                     Parameters                                      ||
|---------|----------------------------------------------------------------------------|
| `round` | `float`: the radius of curvature as a fraction of the smaller width <br /> |

### setSaturation

```
public void setSaturation (float saturation)
```

sets the saturation of the image; 0 = grayscale, 1 = original, 2 = hyper saturated

<br />

### setWarmth

```
public void setWarmth (float warmth)
```

This makes the apparent color temperature of the image warmer or colder.

<br />

|                          Parameters                           ||
|----------|-----------------------------------------------------|
| `warmth` | `float`: 1 is neutral, 2 is warm, .5 is cold <br /> |