ImageFilterButton


public class ImageFilterButton extends AppCompatImageButton


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

Subclass of AppCompatImageButton to handle various common filtering operations.

ImageFilterButton attributes

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 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

Summary

Public constructors

ImageFilterButton(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void
draw(@NonNull Canvas canvas)
float

Returns the currently applied contrast

float

Returns the currently applied crossfade.

float

gts the pan from the center pan of 1 the image is "all the way to the right" if the images width is greater than the screen width, pan = 1 results in the left edge lining up if the images width is less than the screen width, pan = 1 results in the right edges lining up if image width == screen width it does nothing

float

gets the pan from the center pan of 1 the image is "all the way to the bottom" if the images width is greater than the screen height, pan = 1 results in the bottom edge lining up if the images width is less than the screen height, pan = 1 results in the top edges lining up if image height == screen height it does nothing

float

gets the rotation

float

sets the zoom where 1 scales the image just enough to fill the view

float

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

float

Get the fractional corner radius of curvature.

float

Returns the currently applied saturation

float

Returns the currently applied warmth

void
layout(int l, int t, int r, int b)
void

Set the alternative image used to cross fade to.

void
setBrightness(float brightness)

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

void
setContrast(float contrast)

This sets the contrast.

void
setCrossfade(float crossfade)

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

void
void
setImagePanX(float pan)

sets the pan from the center pan of 1 the image is "all the way to the right" if the images width is greater than the screen width, pan = 1 results in the left edge lining up if the images width is less than the screen width, pan = 1 results in the right edges lining up if image width == screen width it does nothing

void
setImagePanY(float pan)

sets the pan from the center pan of 1 the image is "all the way to the bottom" if the images width is greater than the screen height, pan = 1 results in the bottom edge lining up if the images width is less than the screen height, pan = 1 results in the top edges lining up if image height == screen height it does nothing

void
setImageResource(int resId)
void
setImageRotate(float rotation)

sets the rotation angle of the image in degrees

void
setImageZoom(float zoom)

sets the zoom where 1 scales the image just enough to fill the view

void
@RequiresApi(value = Build.VERSION_CODES.LOLLIPOP)
setRound(float round)

Set the corner radius of curvature

void
@RequiresApi(value = Build.VERSION_CODES.LOLLIPOP)
setRoundPercent(float round)

Set the corner radius of curvature as a fraction of the smaller side.

void
setSaturation(float saturation)

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

void
setWarmth(float warmth)

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

Inherited Constants

From android.view.View
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final int
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
static final String
static final String
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
GONE = 8
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
KEEP_SCREEN_ON = 67108864
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
NO_ID = -1
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final String
VIEW_LOG_TAG = "View"
static final int
static final int[]
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>

Inherited methods

From androidx.appcompat.widget.AppCompatImageButton
void
boolean
void

This method is deprecated.

void
void
void
setImageLevel(int level)
void
From android.widget.ImageButton
From android.widget.ImageView
void
final void
void
drawableHotspotChanged(float x, float y)
void
boolean
int
boolean
ColorFilter
boolean
Drawable
int
Matrix
BlendMode
ColorStateList
PorterDuff.Mode
int
int
ImageView.ScaleType
boolean
void
boolean
void
void
int[]
onCreateDrawableState(int extraSpace)
void
void
onDraw(Canvas canvas)
void
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void
onRtlPropertiesChanged(int layoutDirection)
void
onVisibilityAggregated(boolean isVisible)
void
setAdjustViewBounds(boolean adjustViewBounds)
void
setAlpha(int alpha)

This method is deprecated.

void
setBaseline(int baseline)
void
setBaselineAlignBottom(boolean aligned)
final void
setColorFilter(int color, PorterDuff.Mode mode)
void
setCropToPadding(boolean cropToPadding)
boolean
setFrame(int l, int t, int r, int b)
void
setImageAlpha(int alpha)
void
void
void
void
setImageLevel(int level)
void
void
setImageResource(int resId)
void
setImageState(int[] state, boolean merge)
void
void
void
void
void
setMaxHeight(int maxHeight)
void
setMaxWidth(int maxWidth)
void
void
setSelected(boolean selected)
void
setVisibility(int visibility)
boolean
From androidx.core.view.TintableBackgroundView
abstract void

Specifies the blending mode used to apply the tint specified by setSupportBackgroundTintList} to the background drawable.

From android.view.View
void
void
addExtraDataToAccessibilityNodeInfo(
    AccessibilityNodeInfo info,
    String extraDataKey,
    Bundle arguments
)
void
addFocusables(ArrayList<View> views, int direction)
void
void
void
void
void
ViewPropertyAnimator
void
void
boolean
void
void

This method is deprecated.

void
boolean
boolean
boolean
boolean
boolean
canScrollHorizontally(int direction)
boolean
canScrollVertically(int direction)
final void
void
final void
boolean
void
void
void
static int
combineMeasuredStates(int curState, int newState)
int
int
int
void
WindowInsets
int
int
int
AccessibilityNodeInfo
void
void

This method is deprecated.

WindowInsets
boolean
void
void
dispatchCreateViewTranslationRequest(
    Map<AutofillId, long[]> viewIds,
    int[] supportedFormats,
    TranslationCapability capability,
    List<ViewTranslationRequest> requests
)
void
boolean
void
void
dispatchDrawableHotspotChanged(float x, float y)
void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
dispatchNestedFling(float velocityX, float velocityY, boolean consumed)
boolean
dispatchNestedPreFling(float velocityX, float velocityY)
boolean
dispatchNestedPrePerformAccessibilityAction(
    int action,
    Bundle arguments
)
boolean
dispatchNestedPreScroll(
    int dx,
    int dy,
    int[] consumed,
    int[] offsetInWindow
)
boolean
dispatchNestedScroll(
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int[] offsetInWindow
)
void
dispatchPointerCaptureChanged(boolean hasCapture)
boolean
void
void
void
void
void
dispatchScrollCaptureSearch(
    Rect localVisibleRect,
    Point windowOffset,
    Consumer<ScrollCaptureTarget> targets
)
void
dispatchSetActivated(boolean activated)
void
dispatchSetPressed(boolean pressed)
void
dispatchSetSelected(boolean selected)
void
void

This method is deprecated.

boolean
boolean
boolean
dispatchUnhandledMove(View focused, int direction)
void
dispatchVisibilityChanged(View changedView, int visibility)
void
dispatchWindowFocusChanged(boolean hasFocus)
void
void
WindowInsets
WindowInsetsAnimation.Bounds
void

This method is deprecated.

void
View
final OnBackInvokedDispatcher
final T
<T extends View> findViewById(int id)
final T
<T extends View> findViewWithTag(Object tag)
void
findViewsWithText(
    ArrayList<View> outViews,
    CharSequence searched,
    int flags
)
boolean

This method is deprecated.

View
focusSearch(int direction)
void
forceHasOverlappingRendering(boolean hasOverlappingRendering)
void
boolean
void
generateDisplayHash(
    String hashAlgorithm,
    Rect bounds,
    Executor executor,
    DisplayHashResultCallback callback
)
static int
View.AccessibilityDelegate
int
AccessibilityNodeProvider
CharSequence
int
int
String
String
float
Animation
Matrix
IBinder
int[]
Map<IntegerInteger>