Class ARGBType
- java.lang.Object
-
- net.imglib2.type.AbstractNativeType<ARGBType>
-
- net.imglib2.type.numeric.ARGBType
-
- All Implemented Interfaces:
NativeType<ARGBType>,NumericType<ARGBType>,Add<ARGBType>,Div<ARGBType>,Mul<ARGBType>,MulFloatingPoint,Pow<ARGBType>,PowFloatingPoint,SetOne,SetZero,Sub<ARGBType>,ValueEquals<ARGBType>,Type<ARGBType>
- Direct Known Subclasses:
VolatileARGBType.WrappedARGBType
public class ARGBType extends AbstractNativeType<ARGBType> implements NumericType<ARGBType>
AnativeNumericTypethat 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.ARGBTypeimplementsNumericTypeas element-wise vector algebra.
-
-
Field Summary
Fields Modifier and Type Field Description protected IntAccessdataAccessprotected NativeImg<?,? extends IntAccess>imgprivate static NativeTypeFactory<ARGBType,IntAccess>typeFactory-
Fields inherited from class net.imglib2.type.AbstractNativeType
i
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ARGBType c)static intalpha(int value)static intblue(int value)ARGBTypecopy()ARGBTypecreateVariable()Creates a newTypevariable which can only store one value.voiddiv(ARGBType c)ARGBTypeduplicateTypeOnSameNativeImg()Creates a newNativeTypewhich stores in the same physical array.booleanequals(java.lang.Object obj)intget()FractiongetEntitiesPerPixel()Get the number of entities in the storage array required to store one pixel value.NativeTypeFactory<ARGBType,IntAccess>getNativeTypeFactory()static intgreen(int value)inthashCode()voidmul(double c)voidmul(float c)voidmul(ARGBType c)voidpow(double power)voidpow(ARGBType c)static intred(int value)static intrgba(double r, double g, double b, double a)static intrgba(float r, float g, float b, float a)static intrgba(int r, int g, int b, int a)voidset(int f)voidset(ARGBType c)Sets the value of anotherType.voidsetOne()voidsetZero()voidsub(ARGBType c)java.lang.StringtoString()voidupdateContainer(java.lang.Object c)This method is used by an accessor (e.g., aCursor) to request an update of the current data array.booleanvalueEquals(ARGBType t)-
Methods inherited from class net.imglib2.type.AbstractNativeType
index
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.NativeType
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
-
-
-
-
Method Detail
-
updateContainer
public void updateContainer(java.lang.Object c)
Description copied from interface:NativeTypeThis method is used by an accessor (e.g., aCursor) to request an update of the current data array.As an example consider a
CellCursormoving on aCellImg. The cursor maintains aNativeTypewhich provides access to the image data. When the cursor moves from one cell to the next, the underlying data array of theNativeTypemust be switched to the data array of the new cell.To achieve this, the
CellCursorcallsupdateContainer()with itself as the argument.updateContainer()in turn will callNativeImg.update(Object)on it's container, passing along the reference to the cursor. In this example, the container would be aCellImg. While theNativeTypedoes not know about the type of the cursor, the container does.CellImgknows that it is passed aCellCursorinstance, which can be used to figure out the current cell and the underlying data array, which is then returned to theNativeType.The idea behind this concept is maybe not obvious. The
NativeTypeknows 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 ofNativeType.- Specified by:
updateContainerin interfaceNativeType<ARGBType>- Parameters:
c- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
duplicateTypeOnSameNativeImg
public ARGBType duplicateTypeOnSameNativeImg()
Description copied from interface:NativeTypeCreates a newNativeTypewhich stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImgin interfaceNativeType<ARGBType>- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
getNativeTypeFactory
public NativeTypeFactory<ARGBType,IntAccess> getNativeTypeFactory()
- Specified by:
getNativeTypeFactoryin interfaceNativeType<ARGBType>
-
rgba
public static final int rgba(int r, int g, int b, int a)
-
rgba
public static final int rgba(float r, float g, float b, float a)
-
rgba
public static final int rgba(double r, double g, double b, double a)
-
red
public static final int red(int value)
-
green
public static final int green(int value)
-
blue
public static final int blue(int value)
-
alpha
public static final int alpha(int value)
-
get
public int get()
-
set
public void set(int f)
-
mul
public void mul(float c)
- Specified by:
mulin interfaceMulFloatingPoint
-
mul
public void mul(double c)
- Specified by:
mulin interfaceMulFloatingPoint
-
pow
public void pow(double power)
- Specified by:
powin interfacePowFloatingPoint
-
set
public void set(ARGBType c)
Description copied from interface:TypeSets the value of anotherType.
-
createVariable
public ARGBType createVariable()
Description copied from interface:TypeCreates a newTypevariable which can only store one value.- Specified by:
createVariablein interfaceType<ARGBType>- Returns:
- a new
Typevariable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getEntitiesPerPixel
public Fraction getEntitiesPerPixel()
Description copied from interface:NativeTypeGet the number of entities in the storage array required to store one pixel value. A pixel value may be spread over several or less than one entity. For example, a complex number may require 2 entries of a float[] array to store one pixel. Or a 12-bit type might need 12/64th entries of a long[] array.- Specified by:
getEntitiesPerPixelin interfaceNativeType<ARGBType>- Returns:
- the number of storage type entities required to store one pixel value.
-
valueEquals
public boolean valueEquals(ARGBType t)
- Specified by:
valueEqualsin interfaceValueEquals<ARGBType>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-