java.lang.Object | |
↳ | android.support.v7.graphics.Palette |
A helper class to extract prominent colors from an image.
A number of colors with different profiles are extracted from the image:
Instances are created with a Palette.Builder
which supports several options to tweak the
generated Palette. See that class' documentation for more information.
Generation should always be completed on a background thread, ideally the one in
which you load your image on. Palette.Builder
supports both synchronous and asynchronous
generation:
// Synchronous Palette p = Palette.from(bitmap).generate(); // Asynchronous Palette.from(bitmap).generate(new PaletteAsyncListener() { public void onGenerated(Palette p) { // Use generated instance } });
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Palette.Builder |
Builder class for generating Palette instances.
|
||||||||||
Palette.Generator |
Extension point for Palette which allows custom processing of the list of
Palette.Swatch instances which represent an image.
|
||||||||||
Palette.PaletteAsyncListener |
Listener to be used with generateAsync(Bitmap, PaletteAsyncListener) or
generateAsync(Bitmap, int, PaletteAsyncListener)
|
||||||||||
Palette.Swatch | Represents a color swatch generated from an image's palette. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Generate a
Palette from the pre-generated list of Palette.Swatch swatches.
| |||||||||||
Start generating a
Palette with the returned Palette.Builder instance.
| |||||||||||
This method is deprecated.
Use
Palette.Builder to generate the Palette.
| |||||||||||
This method is deprecated.
Use
Palette.Builder to generate the Palette.
| |||||||||||
This method is deprecated.
Use
Palette.Builder to generate the Palette.
| |||||||||||
This method is deprecated.
Use
Palette.Builder to generate the Palette.
| |||||||||||
Returns a muted and dark color from the palette as an RGB packed int.
| |||||||||||
Returns a muted and dark swatch from the palette.
| |||||||||||
Returns a dark and vibrant color from the palette as an RGB packed int.
| |||||||||||
Returns a dark and vibrant swatch from the palette.
| |||||||||||
Returns a muted and light color from the palette as an RGB packed int.
| |||||||||||
Returns a muted and light swatch from the palette.
| |||||||||||
Returns a light and vibrant color from the palette as an RGB packed int.
| |||||||||||
Returns a light and vibrant swatch from the palette.
| |||||||||||
Returns a muted color from the palette as an RGB packed int.
| |||||||||||
Returns a muted swatch from the palette.
| |||||||||||
Returns all of the swatches which make up the palette.
| |||||||||||
Returns the most vibrant color in the palette as an RGB packed int.
| |||||||||||
Returns the most vibrant swatch in the palette.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Generate a Palette
from the pre-generated list of Palette.Swatch
swatches.
This is useful for testing, or if you want to resurrect a Palette
instance from a
list of swatches. Will return null if the swatches
is null.
Start generating a Palette
with the returned Palette.Builder
instance.
Returns a muted and dark color from the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns a muted and dark swatch from the palette. Might be null.
Returns a dark and vibrant color from the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns a dark and vibrant swatch from the palette. Might be null.
Returns a muted and light color from the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns a muted and light swatch from the palette. Might be null.
Returns a light and vibrant color from the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns a light and vibrant swatch from the palette. Might be null.
Returns a muted color from the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns the most vibrant color in the palette as an RGB packed int.
defaultColor | value to return if the swatch isn't available |
---|
Returns the most vibrant swatch in the palette. Might be null.