Showing posts with label graphics. Show all posts
Showing posts with label graphics. Show all posts

Friday, March 13, 2015

How to combine transparent Bitmaps into one Bitmap in Android (JAVA)

This process is pretty straight forward. You create a Bitmap Array[] then you combine all the individual parts together via this function.

First you declare your type:

Bitmap[] parts = new Bitmap[2];

Then you assign each element in the array:

parts[0] = Bitmap.createScaledBitmap(icon1, 120, 120, false);
parts[1] = Bitmap.createScaledBitmap(icon2, 120, 120, false);

Then you stack them together using stackBitmaps(parts):

               finalIcon = stackBitmaps(parts);

Here is the function you need to use:

private static Bitmap stackBitmaps (Bitmap[] parts) {
Bitmap mutableBitmap = parts[0].copy(Bitmap.Config.ARGB_8888, true);
Canvas comboImage = new Canvas(mutableBitmap);
for (int i = 1; i < parts.length; i++)
comboImage.drawBitmap(parts[i], 0f, 0f, null);
return mutableBitmap;
}

Generating "Always On Top" NSWindow in macOS across all detected displays

Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift  Langues, you m...