Untitled
unknown
plain_text
4 years ago
1.7 kB
7
Indexable
imageShoot.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event){
bitmap1 = imageOpponent.getDrawingCache();
Bitmap bitmapBackground = ((BitmapDrawable)imageBackground.getDrawable()).getBitmap();
float xMoveSize = imageAim.getLayoutParams().width;
float yMoveSize = imageAim.getLayoutParams().height;
int x = (int)imageAim.getX() + ((int)xMoveSize/2);
int y = (int)imageAim.getY() + ((int)yMoveSize/2);
//Bitmap bitmap69 = Bitmap.createScaledBitmap(bitmap1, imageOpponent.getWidth(), imageOpponent.getHeight(), false);
textX.setText(String.valueOf(bitmap1.getHeight()));
textY.setText(String.valueOf(bitmap1.getWidth()));
if (x <= bitmap1.getWidth() && y <= bitmap1.getHeight()) {
int pixel = bitmap1.getPixel(x, y);
int redValue = Color.red(pixel);
int blueValue = Color.blue(pixel);
int greenValue = Color.green(pixel);
//if (redValue == 0 && blueValue == 0 && greenValue == 0){
//imageBackground.setBackgroundColor(Color.rgb(redValue,greenValue,blueValue));
if (bitmap1.getPixel(x, y) == Color.TRANSPARENT) {
textY.setText("Czarny " + x + " " + y);
} else {
textY.setText("jakis kolor");
}
}
return true;
}
});Editor is loading...