public class ARGBType extends AbstractNativeType<ARGBType> implements NumericType<ARGBType>
native NumericType that encodes four channels at
unsigned byte precision into one 32bit signed integer which is the format
used in most display oriented image processing libraries such as AWT or
ImageJ. ARGBType implements NumericType as element-wise
vector algebra.| Modifier and Type | Field and Description |
|---|---|
protected IntAccess |
dataAccess |
protected NativeImg<?,? extends IntAccess> |
img |
i| Constructor and Description |
|---|
ARGBType() |
ARGBType(int value) |
ARGBType(IntAccess access) |
ARGBType(NativeImg<?,? extends IntAccess> intStorage) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ARGBType c) |
static int |
alpha(int value) |
static int |
blue(int value) |
ARGBType |
copy()
|
NativeImg<ARGBType,? extends IntAccess> |
createSuitableNativeImg(NativeImgFactory<ARGBType> storageFactory,
long[] dim)
The
NativeType creates the NativeImg used for storing
image data; based on the given storage strategy and its size. |
ARGBType |
createVariable()
Creates a new
Type variable which can only store one value. |
void |
div(ARGBType c) |
ARGBType |
duplicateTypeOnSameNativeImg()
Creates a new
NativeType which stores in the same physical array. |
int |
get() |
Fraction |
getEntitiesPerPixel()
Get the number of entities in the storage array required to store one
pixel value.
|
static int |
green(int value) |
void |
mul(ARGBType c) |
void |
mul(double c) |
void |
mul(float c) |
static int |
red(int value) |
static int |
rgba(double r,
double g,
double b,
double a) |
static int |
rgba(float r,
float g,
float b,
float a) |
static int |
rgba(int r,
int g,
int b,
int a) |
void |
set(ARGBType c)
Sets the value of another
Type. |
void |
set(int f) |
void |
setOne() |
void |
setZero() |
void |
sub(ARGBType c) |
String |
toString() |
void |
updateContainer(Object c)
This method is used by an accessor (e.g., a
Cursor) to request an
update of the current data array. |
boolean |
valueEquals(ARGBType t) |
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndexprotected IntAccess dataAccess
public ARGBType(int value)
public ARGBType(IntAccess access)
public ARGBType()
public NativeImg<ARGBType,? extends IntAccess> createSuitableNativeImg(NativeImgFactory<ARGBType> storageFactory, long[] dim)
NativeTypeNativeType creates the NativeImg used for storing
image data; based on the given storage strategy and its size. It
basically only decides here which BasicType it uses (float, int, byte,
bit, ...) and how many entities per pixel it needs (e.g. 2 floats per
pixel for a complex number). This enables the separation of containers
and the basic types.createSuitableNativeImg in interface NativeType<ARGBType>storageFactory - which storage strategy is useddim - the dimensionsNativeImg where only the Type
knows the BasicType it contains.public void updateContainer(Object c)
NativeTypeCursor) to request an
update of the current data array.
As an example consider a CellCursor moving on a CellImg.
The cursor maintains a NativeType which provides access to the
image data. When the cursor moves from one cell to the next, the
underlying data array of the NativeType must be switched to the
data array of the new cell.
To achieve this, the CellCursor calls updateContainer()
with itself as the argument. updateContainer() in turn will call
NativeImg.update(Object) on it's container, passing along the
reference to the cursor. In this example, the container would be a
CellImg. While the NativeType does not know about the
type of the cursor, the container does. CellImg knows that it is
passed a CellCursor instance, which can be used to figure out the
current cell and the underlying data array, which is then returned to the
NativeType.
The idea behind this concept is maybe not obvious. The NativeType
knows which basic type is used (float, int, byte, ...). However, it does
not know how the data is stored (ArrayImg, CellImg, ...).
This prevents the need for multiple implementations of NativeType
.
updateContainer in interface NativeType<ARGBType>c - reference to an accessor which can be passed on to the
container (which will know what to do with it).public ARGBType duplicateTypeOnSameNativeImg()
NativeTypeNativeType which stores in the same physical array.
This is only used internally.duplicateTypeOnSameNativeImg in interface NativeType<ARGBType>NativeType instance working on the same
NativeImgpublic static final int rgba(int r,
int g,
int b,
int a)
public static final int rgba(float r,
float g,
float b,
float a)
public static final int rgba(double r,
double g,
double b,
double a)
public static final int red(int value)
public static final int green(int value)
public static final int blue(int value)
public static final int alpha(int value)
public int get()
public void set(int f)
public void mul(float c)
mul in interface MulFloatingPointpublic void mul(double c)
mul in interface MulFloatingPointpublic void set(ARGBType c)
TypeType.public ARGBType createVariable()
TypeType variable which can only store one value.createVariable in interface Type<ARGBType>Type variablepublic String toString()
toString in class AbstractNativeType<ARGBType>public Fraction getEntitiesPerPixel()
NativeTypegetEntitiesPerPixel in interface NativeType<ARGBType>public boolean valueEquals(ARGBType t)
valueEquals in interface ValueEquals<ARGBType>Copyright © 2009–2017 ImgLib2. All rights reserved.