com.jhlabs.image

Class PixelUtils


public class PixelUtils
extends java.lang.Object

Some more useful math functions for image processing. These are becoming obsolete as we move to Java2D. Use MiscComposite instead.

Field Summary

static int
ADD
static int
ALPHA
static int
ALPHA_TO_GRAY
static int
AVERAGE
static int
CLEAR
static int
COLOR
static int
DIFFERENCE
static int
DISSOLVE
static int
DST_IN
static int
EXCHANGE
static int
HUE
static int
MAX
static int
MIN
static int
MULTIPLY
static int
NORMAL
static int
OVERLAY
static int
REPLACE
static int
SATURATION
static int
SCREEN
static int
SUBTRACT
static int
VALUE

Method Summary

static int
brightness(int rgb)
static int
clamp(int c)
Clamp a value to the range 0..255
static int
combinePixels(int rgb1, int rgb2, int op)
static int
combinePixels(int rgb1, int rgb2, int op, int extraAlpha)
static int
combinePixels(int rgb1, int rgb2, int op, int extraAlpha, int channelMask)
static int
interpolate(int v1, int v2, float f)
static boolean
nearColors(int rgb1, int rgb2, int tolerance)

Field Details

ADD

public static final int ADD
Field Value:
4

ALPHA

public static final int ALPHA
Field Value:
19

ALPHA_TO_GRAY

public static final int ALPHA_TO_GRAY
Field Value:
20

AVERAGE

public static final int AVERAGE
Field Value:
13

CLEAR

public static final int CLEAR
Field Value:
15

COLOR

public static final int COLOR
Field Value:
11

DIFFERENCE

public static final int DIFFERENCE
Field Value:
6

DISSOLVE

public static final int DISSOLVE
Field Value:
17

DST_IN

public static final int DST_IN
Field Value:
18

EXCHANGE

public static final int EXCHANGE
Field Value:
16

HUE

public static final int HUE
Field Value:
8

MAX

public static final int MAX
Field Value:
3

MIN

public static final int MIN
Field Value:
2

MULTIPLY

public static final int MULTIPLY
Field Value:
7

NORMAL

public static final int NORMAL
Field Value:
1

OVERLAY

public static final int OVERLAY
Field Value:
14

REPLACE

public static final int REPLACE
Field Value:
0

SATURATION

public static final int SATURATION
Field Value:
9

SCREEN

public static final int SCREEN
Field Value:
12

SUBTRACT

public static final int SUBTRACT
Field Value:
5

VALUE

public static final int VALUE
Field Value:
10

Method Details

brightness

public static int brightness(int rgb)

clamp

public static int clamp(int c)
Clamp a value to the range 0..255

combinePixels

public static int combinePixels(int rgb1,
                                int rgb2,
                                int op)

combinePixels

public static int combinePixels(int rgb1,
                                int rgb2,
                                int op,
                                int extraAlpha)

combinePixels

public static int combinePixels(int rgb1,
                                int rgb2,
                                int op,
                                int extraAlpha,
                                int channelMask)

interpolate

public static int interpolate(int v1,
                              int v2,
                              float f)

nearColors

public static boolean nearColors(int rgb1,
                                 int rgb2,
                                 int tolerance)