androidcanvasopenstreetmapnutiteqxfermode

OpenStreetMap add marker to Nutiteq MapView with custom Xfermode


I need to put some markers on top of a Nutiteq MapView. In order to create these markers I create a bitmap with a semi-transparent circle.

int size = (int)(30*mDisplayMetrics.density);
Bitmap androidMarkerBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
Paint paint = new Paint();
paint.setColor(Color.argb(150, 255, 0, 0));

Canvas canvas = new Canvas(androidMarkerBitmap);
canvas.drawCircle(size / 2, size / 2, size / 2, paint);
com.nutiteq.graphics.Bitmap markerBitmap = BitmapUtils.createBitmapFromAndroidBitmap(androidMarkerBitmap);
androidMarkerBitmap.recycle();

Each marker has the same bitmap. The problem is the transparency of the bitmap (as you can see alpha is not 0). When I add many markers all the bitmaps are simply ADDED one over the another... The problem is that I do not want the "add" effect for transparency, but instead I need to obtain the "darken" one.

enter image description here
(source: csdn.net)

Is there a way to change the default Xfermode used when mapView draws markers on it?


Solution

  • No, there is no such option in Nutiteq SDK. The effect you describe would require rendering markers to a separate surface (with 'darken' effect) and then layering the rendered surface (with markers) atop of other layers. Such functionality is pretty expensive and is not implemented in the SDK.