* @param y
* Height
* @return Icon that fits best
*/
private Image getBestIcon(ICOFile ico, int x, int y) {
BitmapDescriptor entry = null;
int curwidth = Integer.MAX_VALUE;
int curheight = Integer.MAX_VALUE;
int curdepth = 0;
List<BitmapDescriptor> descriptors = ico.getDescriptors();
for (BitmapDescriptor desc : descriptors) {
if (Math.abs(x - curwidth) >= Math.abs(x - desc.getWidth())
&& Math.abs(y - curheight) >= Math.abs(y - desc.getHeight())
&& desc.getBPP() > curdepth) {
entry = desc;
}
}
return entry.getImageRGB();
}