-
Notifications
You must be signed in to change notification settings - Fork 982
/
SepiaToneTiles.java
37 lines (28 loc) · 964 Bytes
/
SepiaToneTiles.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.osmdroid.samplefragments.tilesources;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import org.osmdroid.samplefragments.BaseSampleFragment;
/**
* created on 1/8/2017.
*
* @author Alex O'Ree
*/
public class SepiaToneTiles extends BaseSampleFragment {
@Override
public String getSampleTitle() {
return "Sepia tone tiles";
}
@Override
public void addOverlays() {
super.addOverlays();
final ColorMatrix matrixA = new ColorMatrix();
// making image B&W
matrixA.setSaturation(0);
final ColorMatrix matrixB = new ColorMatrix();
// applying scales for RGB color values
matrixB.setScale(1f, .95f, .82f, 1.0f);
matrixA.setConcat(matrixB, matrixA);
final ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrixA);
mMapView.getOverlayManager().getTilesOverlay().setColorFilter(filter);
}
}