Git Product home page Git Product logo

bitmapmerger's Introduction

Android Arsenal Travis CI

BitmapMerger

Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background threads thereby taking the load away from UI thread. Along with merge, it also contains the image decoder for decoding images from resources/disk and are sampled to prevent OutOfMemoryError.

Examples of Bitmap Merger with this project

Merging at angle away Merging at center Merging with offsets
merge_angle_small merge_at_center_small merge_offset_small
Moon moving around the earth for various angles Stamp at center of the document being scaled Balloon flying in a beach with various offset values

###Usage :

####Merging at angle away

int angle = 90; // your angle here
float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .setAngle(angle)
                    .merge();

####Merging at center

float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .merge();

####Merging with offsets from top left

int leftOffset = 0; // your left offset in pixels
int topOffset = 0; // your top offset in pixels
float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .setOffsets(leftOffset,topOffset)
                    .merge();

Developed By

bitmapmerger's People

Contributors

johnjohndoe avatar sharish avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.