fix(images): java.lang.IllegalArgumentException: x must be < bitmap.width() in images.findMultiColors()
This commit is contained in:
@@ -34,6 +34,7 @@ import android.view.Gravity;
|
|||||||
import com.stardust.scriptdroid.BuildConfig;
|
import com.stardust.scriptdroid.BuildConfig;
|
||||||
import com.stardust.scriptdroid.ui.edit.theme.Theme;
|
import com.stardust.scriptdroid.ui.edit.theme.Theme;
|
||||||
import com.stardust.scriptdroid.ui.edit.theme.TokenMapping;
|
import com.stardust.scriptdroid.ui.edit.theme.TokenMapping;
|
||||||
|
import com.stardust.util.ClipboardUtil;
|
||||||
import com.stardust.util.TextUtils;
|
import com.stardust.util.TextUtils;
|
||||||
|
|
||||||
import org.mozilla.javascript.Token;
|
import org.mozilla.javascript.Token;
|
||||||
@@ -135,6 +136,14 @@ public class CodeEditText extends AppCompatEditText {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTextContextMenuItem(int id) {
|
||||||
|
if (id == android.R.id.paste) {
|
||||||
|
ClipboardUtil.setClip(getContext(), ClipboardUtil.getClip(getContext()).toString());
|
||||||
|
}
|
||||||
|
return super.onTextContextMenuItem(id);
|
||||||
|
}
|
||||||
|
|
||||||
//该方法中内联了很多函数来提高效率 但是 这是必要的吗???
|
//该方法中内联了很多函数来提高效率 但是 这是必要的吗???
|
||||||
// 绘制文本着色
|
// 绘制文本着色
|
||||||
private void drawText(Canvas canvas) {
|
private void drawText(Canvas canvas) {
|
||||||
|
|||||||
@@ -110,7 +110,12 @@ public class ColorFinder {
|
|||||||
int y = points[i + 1];
|
int y = points[i + 1];
|
||||||
int color = points[i + 2];
|
int color = points[i + 2];
|
||||||
ColorDetector colorDetector = new ColorDetector.DifferenceDetector(color, threshold);
|
ColorDetector colorDetector = new ColorDetector.DifferenceDetector(color, threshold);
|
||||||
int c = image.pixel((int) (x + startingPoint.x), (int) (y + startingPoint.y));
|
x += startingPoint.x;
|
||||||
|
y += startingPoint.y;
|
||||||
|
if (x >= image.getWidth() || y >= image.getHeight()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int c = image.pixel(x, y);
|
||||||
if (!colorDetector.detectsColor(Color.red(c), Color.green(c), Color.blue(c))) {
|
if (!colorDetector.detectsColor(Color.red(c), Color.green(c), Color.blue(c))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user