Compare commits
2 Commits
gallery-v1
...
UseWINBOT
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a700a0808 | |||
| dad179c15f |
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Apr 28 17:21:55 HKT 2026
|
#Tue Apr 28 19:41:44 CST 2026
|
||||||
stageCount=10
|
stageCount=10
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.9
|
publishVersion=15.0.9
|
||||||
buildCount=0
|
buildCount=11
|
||||||
baseBetaVersion=15.0.10
|
baseBetaVersion=15.0.10
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cc.winboll.studio.gallery;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -115,10 +116,11 @@ public class CropActivity extends AppCompatActivity {
|
|||||||
cropCanvasView = findViewById(R.id.crop_canvas_view);
|
cropCanvasView = findViewById(R.id.crop_canvas_view);
|
||||||
|
|
||||||
final View colorView = findViewById(R.id.color_view);
|
final View colorView = findViewById(R.id.color_view);
|
||||||
|
final GradientDrawable colorDrawable = (GradientDrawable) colorView.getBackground();
|
||||||
cropCanvasView.setOnBackgroundColorChangedListener(new CropCanvasView.OnBackgroundColorChangedListener() {
|
cropCanvasView.setOnBackgroundColorChangedListener(new CropCanvasView.OnBackgroundColorChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onBackgroundColorChanged(int color) {
|
public void onBackgroundColorChanged(int color) {
|
||||||
colorView.setBackgroundColor(color);
|
colorDrawable.setColor(color);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -127,6 +129,7 @@ public class CropActivity extends AppCompatActivity {
|
|||||||
public void onColorPicked(int color) {
|
public void onColorPicked(int color) {
|
||||||
int pickX = cropCanvasView.getLastPickImageX();
|
int pickX = cropCanvasView.getLastPickImageX();
|
||||||
int pickY = cropCanvasView.getLastPickImageY();
|
int pickY = cropCanvasView.getLastPickImageY();
|
||||||
|
colorDrawable.setColor(color);
|
||||||
Toast.makeText(CropActivity.this,
|
Toast.makeText(CropActivity.this,
|
||||||
"颜色已拾取: #" + String.format("%06X", color & 0xFFFFFF) +
|
"颜色已拾取: #" + String.format("%06X", color & 0xFFFFFF) +
|
||||||
" (" + pickX + "," + pickY + ")",
|
" (" + pickX + "," + pickY + ")",
|
||||||
@@ -142,7 +145,7 @@ public class CropActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
colorView.setBackgroundColor(cropCanvasView.getBackgroundColor());
|
colorDrawable.setColor(cropCanvasView.getBackgroundColor());
|
||||||
|
|
||||||
loadImage();
|
loadImage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -518,7 +518,15 @@ public class CropCanvasView extends View {
|
|||||||
if (colorPickMode) {
|
if (colorPickMode) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
|
if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||||
if (originalBitmap != null && !originalBitmap.isRecycled()) {
|
if (originalBitmap != null && !originalBitmap.isRecycled()) {
|
||||||
|
float imgX = screenToImageX(x);
|
||||||
|
float imgY = screenToImageY(y);
|
||||||
|
if (imageBounds.contains(imgX, imgY)) {
|
||||||
previewColor = getImageColorAt(x, y);
|
previewColor = getImageColorAt(x, y);
|
||||||
|
} else if (canvasBounds.contains(x, y)) {
|
||||||
|
previewColor = backgroundColor;
|
||||||
|
} else {
|
||||||
|
previewColor = Color.TRANSPARENT;
|
||||||
|
}
|
||||||
lastPickX = x;
|
lastPickX = x;
|
||||||
lastPickY = y;
|
lastPickY = y;
|
||||||
if (backgroundColorChangedListener != null) {
|
if (backgroundColorChangedListener != null) {
|
||||||
@@ -528,10 +536,19 @@ public class CropCanvasView extends View {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
if (previewColor != 0 && previewColor != Color.TRANSPARENT) {
|
if (canvasBounds.contains(x, y)) {
|
||||||
backgroundColor = previewColor;
|
int pickedColor;
|
||||||
|
float imgX = screenToImageX(x);
|
||||||
|
float imgY = screenToImageY(y);
|
||||||
|
if (imageBounds.contains(imgX, imgY)) {
|
||||||
|
int colorAtPoint = getImageColorAt(x, y);
|
||||||
|
pickedColor = colorAtPoint;
|
||||||
|
backgroundColor = colorAtPoint;
|
||||||
|
} else {
|
||||||
|
pickedColor = backgroundColor;
|
||||||
|
}
|
||||||
if (colorPickedListener != null) {
|
if (colorPickedListener != null) {
|
||||||
colorPickedListener.onColorPicked(backgroundColor);
|
colorPickedListener.onColorPicked(pickedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (colorPickEndListener != null) {
|
if (colorPickEndListener != null) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="oval">
|
android:shape="oval">
|
||||||
<solid android:color="@android:color/holo_green_dark"/>
|
<solid android:color="@android:color/transparent"/>
|
||||||
|
<stroke android:width="2dp" android:color="@android:color/white"/>
|
||||||
<size android:width="32dp" android:height="32dp"/>
|
<size android:width="32dp" android:height="32dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
android:id="@+id/color_icon_container"
|
android:id="@+id/color_icon_container"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginStart="8dp">
|
android:layout_marginStart="8dp"
|
||||||
|
android:background="@android:color/transparent">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/color_view"
|
android:id="@+id/color_view"
|
||||||
@@ -34,12 +35,6 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@drawable/bg_color_circle"/>
|
android:background="@drawable/bg_color_circle"/>
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/bg_color_circle_border"/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
Reference in New Issue
Block a user