Java Code Examples for android.graphics.Bitmap.Config#ALPHA_8

The following examples show how to use android.graphics.Bitmap.Config#ALPHA_8 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitmapTools.java    From starcor.xul with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static Bitmap.Config getConfig(Bitmap bmp) {
	Config cfg = bmp.getConfig();
	if (cfg != null) {
		return cfg;
	}
	switch (bmp.getRowBytes() / bmp.getWidth()) {
	case 4: // 32bits rgba8888
		return Config.ARGB_8888;
	case 2: // 16bits rgb565
		return Config.RGB_565;
	case 1: // 8bit
		return Config.ALPHA_8;
	default:
		return defaultConfig;
	}
}
 
Example 2
Source File: ImageCache.java    From graphics-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 *
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 3
Source File: ImageCache.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * 
 * @param config
 *            The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
	if (config == Config.ARGB_8888) {
		return 4;
	} else if (config == Config.RGB_565) {
		return 2;
	} else if (config == Config.ARGB_4444) {
		return 2;
	} else if (config == Config.ALPHA_8) {
		return 1;
	}
	return 1;
}
 
Example 4
Source File: ImageCache.java    From RoMote with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 5
Source File: ImageCache.java    From malevich with MIT License 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 6
Source File: Cache.java    From tns-core-modules-widgets with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 *
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 7
Source File: ImageCache.java    From BubbleCloudView with MIT License 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 8
Source File: ImageCache.java    From android-DisplayingBitmaps with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 9
Source File: ImageProvider.java    From cube-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 *
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}
 
Example 10
Source File: ImageCache.java    From vocefiscal-android with Apache License 2.0 5 votes vote down vote up
/**
 * Return the byte usage per pixel of a bitmap based on its configuration.
 * @param config The bitmap configuration.
 * @return The byte usage per pixel.
 */
private static int getBytesPerPixel(Config config) {
    if (config == Config.ARGB_8888) {
        return 4;
    } else if (config == Config.RGB_565) {
        return 2;
    } else if (config == Config.ARGB_4444) {
        return 2;
    } else if (config == Config.ALPHA_8) {
        return 1;
    }
    return 1;
}