Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Return a drawable object associated with a particular resource ID.
- * Various types of objects will be returned depending on the underlying
- * resource -- for example, a solid color, PNG image, scalable image, etc.
- * The Drawable API hides these implementation details.
- *
- * mtwebster: This version also applies a Porter Duff color mask onto the object before
- * returning the object. Put in Resources to give reusability, I plan on
- * applying this to other parts of the gui
- *
- * @param id The desired resource identifier, as generated by the aapt tool.
- * This integer encodes the package, type, and resource entry.
- * The value 0 is an invalid identifier.
- * @param mask The color mask to use (alpha-r-g-b)
- * @param masktype The Porter Duff filter mode
- * @throws NotFoundException Throws NotFoundException if the given ID does
- * not exist.
- * @return Drawable An object that can be used to draw this resource.
- * @hide
- */
- public Drawable getDrawable(int id, int mask, Mode maskType) throws NotFoundException {
- synchronized (mTmpValue) {
- TypedValue value = mTmpValue;
- getValue(id, value, true);
- Drawable tmpDrawable = loadDrawable(value, id);
- tmpDrawable.setColorFilter(mask, maskType);
- return tmpDrawable;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement