我有一个使用路径修改器移动的动画精灵,我想限制该精灵不应该在特定的像素颜色上移动。所以我尝试使用获取像素和颜色,但我无法找到该颜色的颜色代码。谁能帮我在andengine 2.0中做到这一点?
int width = src.getWidth();
int height = src.getHeight();
// create output bitmap
Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
// color information
int A, R, G, B;
int pixel;
int px;
px = src.getPixel(CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2);
R = Color.red(px);
G = Color.green(px);
B = Color.blue(px);
int colblck = Color.rgb(R, G, B);
Log.e("Tag","Color code for center " + colblck);
// scan through all pixels
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
// get pixel color
pixel = src.getPixel(x, y);
// get color on each channel
// A = Color.alpha(pixel);
R = Color.red(pixel);
G = Color.green(pixel);
B = Color.blue(pixel);
String cd = "" + 00 + 00 + 00;
bmOut.setPixel(x, y, Color.rgb(255, 0, 0));