java.lang.Object | |
↳ | android.support.v7.graphics.Palette.Builder |
Builder class for generating Palette
instances.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a new
Palette.Builder using a source Bitmap
| |||||||||||
Construct a new
Palette.Builder using a list of Palette.Swatch instances.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a filter to be able to have fine grained controlled over the colors which are
allowed in the resulting palette.
| |||||||||||
Clear all added filters.
| |||||||||||
Generate and return the
Palette synchronously.
| |||||||||||
Generate the
Palette asynchronously.
| |||||||||||
Set the maximum number of colors to use in the quantization step when using a
Bitmap as the source.
| |||||||||||
Set the resize value when using a
Bitmap as the source.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Construct a new Palette.Builder
using a list of Palette.Swatch
instances.
Typically only used for testing.
Add a filter to be able to have fine grained controlled over the colors which are allowed in the resulting palette.
filter | filter to add. |
---|
Clear all added filters. This includes any default filters added automatically by
Palette
.
Generate the Palette
asynchronously. The provided listener's
onGenerated(Palette)
method will be called with the palette when
generated.
Set the maximum number of colors to use in the quantization step when using a
Bitmap
as the source.
Good values for depend on the source image type. For landscapes, good values are in the range 10-16. For images which are largely made up of people's faces then this value should be increased to ~24.
Set the resize value when using a Bitmap
as the source.
If the bitmap's largest dimension is greater than the value specified, then the bitmap
will be resized so that it's largest dimension matches maxDimension
. If the
bitmap is smaller or equal, the original is used as-is.
This value has a large effect on the processing time. The larger the resized image is, the greater time it will take to generate the palette. The smaller the image is, the more detail is lost in the resulting image and thus less precision for color selection.