Created
June 23, 2016 20:08
-
-
Save patrickhammond/a206c80f5c2a62101594c51931163939 to your computer and use it in GitHub Desktop.
Tinting a map marker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap markerBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.mapmarker); | |
Bitmap resultBitmap = Bitmap.createBitmap(markerBitmap, 0, 0, markerBitmap.getWidth() - 1, markerBitmap.getHeight() - 1); | |
ColorFilter filter = new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); | |
Paint markerPaint = new Paint(); | |
markerPaint.setColorFilter(filter); | |
Canvas canvas = new Canvas(resultBitmap); | |
canvas.drawBitmap(resultBitmap, 0, 0, markerPaint); | |
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(resultBitmap)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment