colors - android studio cannot resolve symbol "ff" -
i trying retrieve value of red, green,blue pixel color value .so need perform shift , multiply operation.but android studio notifying above error @ following code.
clr=bm.getpixel(0,0); cred=(clr & 0*ff)>>16; tv.append((string.valueof(clr))); tv.append((string.valueof(cred)));
error:cannot resolve symbol ff @ line no 2;
it should 0xff
, not 0*ff
cred=(clr & 0xff)>>16;
0*ff
multiplying 0
unknown symbol ff
(since don't have variable named ff
in scope)
while above code compile , resolve error, not correct code reading red color value bitmap pixel. correct code be
cred = (clr >> 16) & 0xff;
but easiest , safest way use color
class.
int = color.alpha(clr); int r = color.red(clr); int g = color.green(clr); int b = color.blue(clr);
Comments
Post a Comment