Class FillValues
java.lang.Object
org.apache.sis.internal.coverage.j2d.FillValues
Helper class for handling the fill values of a raster. A value can be specified for each band.
- Since:
- 1.2
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ObjectThe fill values as an array of primitive type:int[],float[]ordouble[].final booleantrueif all values inasPrimitiveArrayare positive 0. -
Constructor Summary
ConstructorsConstructorDescriptionFillValues(SampleModel model, Number[] values, boolean allowFloat) Stores the given fill values as an array of primitive type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this object with given object for equality.voidfill(WritableRaster tile) Fills the given raster with the fill value.voidfill(WritableRenderedImage image) Fills the given image with the fill value.inthashCode()Returns a hash code for the fill values.
-
Field Details
-
asPrimitiveArray
The fill values as an array of primitive type:int[],float[]ordouble[]. No other type is allowed. This field is never null and the array length is the number of bands. -
isFullyZero
public final boolean isFullyZerotrueif all values inasPrimitiveArrayare positive 0. This is the value of newly constructed Java arrays orRasterinstances. Consequently, calls tofill(WritableRaster)can be skipped if the raster is new and this flag istrue.
-
-
Constructor Details
-
FillValues
Stores the given fill values as an array of primitive type. If the given array isnull, or if any element in the given array isnull, then the default fill value is NaN for floating point data types or zero for integer data types. If the array is shorter than the number of bands, then above-cited default values are used for missing values. If longer than the number of bands, extraneous values are ignored.- Parameters:
model- the sample model of the image for which to prepare fill values.values- the fill values, ornullfor the default values.allowFloat- whether to allowasPrimitiveArrayto befloat[]. Iffalse, thenasPrimitiveArraycan only bedouble[]orint[].
-
-
Method Details
-
fill
Fills the given raster with the fill value. The raster sample model should be the same than the sample model specified at construction time of thisFillValuesobject.Implementation note
This method fills the raster using its API, without direct access to the backing array. We do not use direct array access because it would disable Java2D hardware acceleration in subsequent operations.- Parameters:
tile- the raster to fill.- See Also:
-
fill
Fills the given image with the fill value. The image sample model should be the same than the sample model specified at construction time of thisFillValuesobject.- Parameters:
image- the image to fill.
-
equals
Compares this object with given object for equality. -
hashCode
public int hashCode()Returns a hash code for the fill values.
-