Skip to content

Commit

Permalink
Add render tests for {text,icon}-halo-{blur,width}
Browse files Browse the repository at this point in the history
  • Loading branch information
anandthakker committed Feb 7, 2017
1 parent 6ccb5ca commit 05bb0a2
Show file tree
Hide file tree
Showing 11 changed files with 282 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/data/program_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ class ProgramConfiguration {
setUniforms(gl, program, layer, globalProperties) {
for (const uniform of this.uniforms) {
const value = layer.getPaintValue(uniform.property, globalProperties);
console.log(uniform.name, value)
if (uniform.components === 4) {
gl.uniform4fv(program[uniform.name], value);
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/render/draw_symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ function drawTileSymbols(program, painter, layer, tile, buffers, isText, isSDF,
gl.uniform1f(program.u_gamma_scale, gammaScale);

if (hasHalo) { // Draw halo underneath the text.
console.log('u_font_scale', fontScale)
console.log('u_gamma_scale', gammaScale)
gl.uniform1f(program.u_is_halo, 1);
drawSymbolElements(buffers, layer, gl, program);
}
Expand Down
4 changes: 4 additions & 0 deletions src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -2542,6 +2542,7 @@
"minimum": 0,
"function": "interpolated",
"zoom-function": true,
"property-function": true,
"transition": true,
"units": "pixels",
"doc": "Distance of halo to the icon outline.",
Expand All @@ -2564,6 +2565,7 @@
"minimum": 0,
"function": "interpolated",
"zoom-function": true,
"property-function": true,
"transition": true,
"units": "pixels",
"doc": "Fade out the halo towards the outside.",
Expand Down Expand Up @@ -2705,6 +2707,7 @@
"minimum": 0,
"function": "interpolated",
"zoom-function": true,
"property-function": true,
"transition": true,
"units": "pixels",
"doc": "Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",
Expand All @@ -2727,6 +2730,7 @@
"minimum": 0,
"function": "interpolated",
"zoom-function": true,
"property-function": true,
"transition": true,
"units": "pixels",
"doc": "The halo's fadeout distance towards the outside.",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "x": 0 },
"geometry": {
"type": "Point",
"coordinates": [
0,
-10
]
}
}, {
"type": "Feature",
"properties": { "x": 1 },
"geometry": {
"type": "Point",
"coordinates": [
0,
10
]
}
}
]
}
}
},
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": "dot.sdf"
},
"paint": {
"icon-halo-width": 3,
"icon-halo-color": "green",
"icon-halo-blur": {
"property": "x",
"stops": [
[
0,
1
],
[
1,
3
]
]
}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "x": 0 },
"geometry": {
"type": "Point",
"coordinates": [
0,
-10
]
}
}, {
"type": "Feature",
"properties": { "x": 1 },
"geometry": {
"type": "Point",
"coordinates": [
0,
10
]
}
}
]
}
}
},
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": "dot.sdf"
},
"paint": {
"icon-halo-color": "blue",
"icon-halo-width": {
"property": "x",
"stops": [
[
0,
1
],
[
1,
3
]
]
}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "x": 0 },
"geometry": {
"type": "Point",
"coordinates": [
0,
-10
]
}
}, {
"type": "Feature",
"properties": { "x": 1 },
"geometry": {
"type": "Point",
"coordinates": [
0,
10
]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"text-field": "ABC",
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
]
},
"paint": {
"text-halo-width": 2,
"text-halo-color": "blue",
"text-halo-blur": {
"property": "x",
"stops": [
[
0,
1
],
[
1,
3
]
]
}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version": 8,
"metadata": {
"test": {
"width": 64,
"height": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "x": 0 },
"geometry": {
"type": "Point",
"coordinates": [
0,
-10
]
}
}, {
"type": "Feature",
"properties": { "x": 1 },
"geometry": {
"type": "Point",
"coordinates": [
0,
10
]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"text-field": "ABC",
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
]
},
"paint": {
"text-halo-color": "orange",
"text-halo-width": {
"property": "x",
"stops": [
[
0,
1
],
[
1,
3
]
]
}
}
}
]
}

0 comments on commit 05bb0a2

Please sign in to comment.