好的,我从这个抽象开始: https://dl.dropboxusercontent.com/u/43058382/property.png
我需要它看起来像这样: https://dl.dropboxusercontent.com/u/43058382/property_2.png
private Bitmap createIconMapMarker(Drawable bottom, Drawable top, int color, boolean black_white, boolean split_property) {
Bitmap marker;
if (black_white) {
// if true I make image black and white.
} else {
if (split_property) {
// if this is true, I need a marker that is half one color, half another
// for now I'm just setting each one to that color
PorterDuff.Mode mode = PorterDuff.Mode.MULTIPLY;
bottom.setColorFilter(michael, mode);
top.setColorFilter(franklin, mode);
} else {
// if it's not true, I only need to color the bottom layer
PorterDuff.Mode mode = PorterDuff.Mode.MULTIPLY;
bottom.setColorFilter(color, mode);
}
}
marker = Bitmap.createBitmap(bottom.getIntrinsicWidth(),
bottom.getIntrinsicHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(marker);
if (split_property) {
//need code here
// possibly just remove half the pixels from one layer
// possibly apply some sort of linear gradient filter
} else {
bottom.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
top.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
bottom.draw(canvas);
top.draw(canvas);
}
答案 0 :(得分:0)
我刚刚创建了另一个只有一半图像的资源文件。现在我单独给它们上色,一切都很好。