Skip to content

Commit

Permalink
Arbitrary size BlurryAurora is now supported
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Jun 4, 2017
1 parent 6ed83bd commit 55e6b12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testBlurryAurora() throws Exception {
Method mostOccurringColour = getMethodFromClass(factory.getClass(), "determineDominantColour", Bitmap.class);
int output = (int) mostOccurringColour.invoke(factory, redImage);

Bitmap gradient = factory.createAuroraBasedUponColour(output, new BlurryAurora(appContext), 1200, 1920);
Bitmap gradient = factory.createAuroraBasedUponColour(output, new BlurryAurora(appContext), 2400, 3840);

saveImageToExternalStorage(gradient);
}
Expand Down
12 changes: 3 additions & 9 deletions app/src/main/java/be/abyx/aurora/BlurryAurora.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@ public BlurryAurora(Context context) {

@Override
public Bitmap render(int width, int height, int colour) {
if (width > 1200) {
throw new RuntimeException("Only widths up to 1200 pixels are supported at the moment!");
}

if (height > 1920) {
throw new RuntimeException("Only heights up to 1920 pixels are supported at the moment!");
}

// Force disable the automatic density scaling
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inScaled = false;

Bitmap sourceBitmap = BitmapFactory.decodeResource(context.getResources(), R.raw.aurora_fancy_template, opts);
Bitmap originalBitmap = BitmapFactory.decodeResource(context.getResources(), R.raw.aurora_fancy_template, opts);
Bitmap sourceBitmap = Bitmap.createScaledBitmap(originalBitmap, width, height, true);
originalBitmap.recycle();

int originalWidth = sourceBitmap.getWidth();
int originalHeight = sourceBitmap.getHeight();
Expand Down

0 comments on commit 55e6b12

Please sign in to comment.