Skip to content

Commit

Permalink
update stable 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hoanglam10499 committed Oct 30, 2023
1 parent 95e8e56 commit 5643d00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
22 changes: 3 additions & 19 deletions android/src/main/java/com/dropShadow/DropShadowLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected void onMeasure(int widthSpec, int heightSpec) {
content.recycle();
hasContent = false;
content = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
draw.setBitmap(to4BytesPerPixelBitmap(content));
draw.setBitmap(content);
}
invalidate();
}
Expand All @@ -137,26 +137,10 @@ public void dispatchDraw(Canvas canvas) {
}
x = dX - ((shadow.getWidth() - content.getWidth()) / 2);
y = dY - ((shadow.getHeight() - content.getHeight()) / 2);
canvas.drawBitmap(to4BytesPerPixelBitmap(shadow), x, y, paint);
canvas.drawBitmap(shadow, x, y, paint);
}
canvas.drawBitmap(to4BytesPerPixelBitmap(content), 0f, 0f, null);
canvas.drawBitmap(content, 0f, 0f, null);
}
super.dispatchDraw(canvas);
}

/**
* Convert a Bitmap to a Bitmap that has 4 bytes per pixel
*
* @param input The bitmap to convert to a 4 bytes per pixel Bitmap
* @return The converted Bitmap. Note: The caller of this method is
* responsible for reycling the input
*/
public static Bitmap to4BytesPerPixelBitmap(@NonNull final Bitmap input) {
final Bitmap bitmap = Bitmap.createBitmap(input.getWidth(), input.getHeight(), Bitmap.Config.ARGB_8888);
// Instantiate the canvas to draw on:
final Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(input, 0, 0, null);
// Return the new bitmap:
return bitmap;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-drop-shadow",
"version": "0.0.9",
"version": "1.0.0",
"description": "is a small and simple package that helps make your React Native app",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down

0 comments on commit 5643d00

Please sign in to comment.