[core] add raster-resampling property (#12176)

* update style-code for raster-resampling

* implement user-defined raster-resampling

* invert filter condition

* raster-resampling -> raster-resampling-mode for darwin language conventions
This commit is contained in:
Molly Lloyd
2018-06-21 14:37:17 -07:00
committed by GitHub
parent eb70b89849
commit e1af62e87d
24 changed files with 341 additions and 6 deletions

View File

@@ -570,6 +570,27 @@ public final class Property {
@Retention(RetentionPolicy.SOURCE)
public @interface FILL_EXTRUSION_TRANSLATE_ANCHOR {}
// RASTER_RESAMPLING: The resampling/interpolation method to use for overscaling, also known as texture magnification filter
/**
* (Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscaled
*/
public static final String RASTER_RESAMPLING_LINEAR = "linear";
/**
* Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled
*/
public static final String RASTER_RESAMPLING_NEAREST = "nearest";
/**
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
*/
@StringDef({
RASTER_RESAMPLING_LINEAR,
RASTER_RESAMPLING_NEAREST,
})
@Retention(RetentionPolicy.SOURCE)
public @interface RASTER_RESAMPLING {}
// HILLSHADE_ILLUMINATION_ANCHOR: Direction of light source when map is rotated.
/**

View File

@@ -1335,6 +1335,26 @@ public class PropertyFactory {
return new PaintPropertyValue<>("raster-contrast", expression);
}
/**
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
*
* @param value a String value
* @return property wrapper around String
*/
public static PropertyValue<String> rasterResampling(@Property.RASTER_RESAMPLING String value) {
return new PaintPropertyValue<>("raster-resampling", value);
}
/**
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
*
* @param expression an expression statement
* @return property wrapper around an expression statement
*/
public static PropertyValue<Expression> rasterResampling(Expression expression) {
return new PaintPropertyValue<>("raster-resampling", expression);
}
/**
* Fade duration when a new tile is added.
*

View File

@@ -263,6 +263,17 @@ public class RasterLayer extends Layer {
nativeSetRasterContrastTransition(options.getDuration(), options.getDelay());
}
/**
* Get the RasterResampling property
*
* @return property wrapper value around String
*/
@SuppressWarnings("unchecked")
public PropertyValue<String> getRasterResampling() {
checkThread();
return (PropertyValue<String>) new PropertyValue("raster-resampling", nativeGetRasterResampling());
}
/**
* Get the RasterFadeDuration property
*
@@ -310,6 +321,8 @@ public class RasterLayer extends Layer {
private native void nativeSetRasterContrastTransition(long duration, long delay);
private native Object nativeGetRasterResampling();
private native Object nativeGetRasterFadeDuration();
@Override