0
사용자가 비트 맵을 가져 와서 아래에서 볼 수있는 것을 수행하여 눈에 띄는 색상을 추출하려고 시도하지만 작동하지 않는 것 같습니다.비트 맵의 눈에 띄는 색상을 검색하는 Android
final Map<Integer, Integer> getColorsFromImage;
{
int mostlyUsed = 0;
final int widthInPx = drawView.getDrawingCache().getWidth();
final int heightInPx = drawView.getDrawingCache().getHeight();
Map<Integer, Integer> colors = new HashMap<Integer, Integer>(); // rgb
int count = 0;
int currentColor = 0;
for(int x = 0; x < widthInPx; x++){
for(int y = 0; y < heightInPx; y++){
count = 0;
currentColor = drawView.getDrawingCache().getPixel(widthInPx, heightInPx);
if(colors.containsKey(currentColor)){
count = colors.get(currentColor) + 1;
}
if (count > mostlyUsed) {
mostlyUsed = count;
}
colors.put(currentColor, count);
count = 0;
}
}
Integer mostlyUsedColor = colors.get(mostlyUsed);
switch (mostlyUsedColor){
case #A52A2A:
do sth;
break;
case #FFFFFF:
(...)
}
이에 대한 제안 사항이 있으십니까?