Skip to content

Commit

Permalink
Fixed RectangleShape
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Jun 12, 2017
1 parent d682645 commit 0f43f13
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/src/main/java/be/abyx/aurora/RectangleShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ private Bitmap createCenteredBitmapWithPadding(Bitmap input, int padding) {
int[] outputPixels = new int[(width + 2 * padding) * (height + 2 * padding)];

int[] inputPixels = new int[input.getWidth() * input.getHeight()];

int differenceWidth = width - input.getWidth() - padding;
int differenceHeight = height - input.getHeight() - padding;
input.getPixels(inputPixels, 0, input.getWidth(), 0, 0, input.getWidth(), input.getHeight());

// Copy the original image to the new image and center it.
for (int x = 0; x < input.getWidth(); x++) {
for (int y = 0; y < input.getHeight(); y++) {
outputPixels[(y + differenceHeight) * (width + 2 * padding) + x + differenceWidth] = inputPixels[y * input.getWidth() + x];
outputPixels[(y + padding) * (width + 2 * padding) + x + padding] = inputPixels[y * input.getWidth() + x];
}
}

Expand Down

0 comments on commit 0f43f13

Please sign in to comment.