Annotate ARGB integer parameters with @ColorInt

Change-Id: I307f72a382272cf18ddb6b07d9fcb81228568d9a
This commit is contained in:
Tor Norbye
2015-03-02 09:39:27 -08:00
parent cb59f2afb7
commit 80756e3888
25 changed files with 132 additions and 62 deletions

View File

@@ -16,6 +16,7 @@
package android.graphics;
import android.annotation.ColorInt;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
@@ -1278,7 +1279,7 @@ public final class Bitmap implements Parcelable {
*
* @throws IllegalStateException if the bitmap is not mutable.
*/
public void eraseColor(int c) {
public void eraseColor(@ColorInt int c) {
checkRecycled("Can't erase a recycled bitmap");
if (!isMutable()) {
throw new IllegalStateException("cannot erase immutable bitmaps");
@@ -1296,6 +1297,7 @@ public final class Bitmap implements Parcelable {
* @return The argb {@link Color} at the specified coordinate
* @throws IllegalArgumentException if x, y exceed the bitmap's bounds
*/
@ColorInt
public int getPixel(int x, int y) {
checkRecycled("Can't call getPixel() on a recycled bitmap");
checkPixelAccess(x, y);
@@ -1325,7 +1327,7 @@ public final class Bitmap implements Parcelable {
* @throws ArrayIndexOutOfBoundsException if the pixels array is too small
* to receive the specified number of pixels.
*/
public void getPixels(int[] pixels, int offset, int stride,
public void getPixels(@ColorInt int[] pixels, int offset, int stride,
int x, int y, int width, int height) {
checkRecycled("Can't call getPixels() on a recycled bitmap");
if (width == 0 || height == 0) {
@@ -1407,7 +1409,7 @@ public final class Bitmap implements Parcelable {
* @throws IllegalArgumentException if x, y are outside of the bitmap's
* bounds.
*/
public void setPixel(int x, int y, int color) {
public void setPixel(int x, int y, @ColorInt int color) {
checkRecycled("Can't call setPixel() on a recycled bitmap");
if (!isMutable()) {
throw new IllegalStateException();
@@ -1439,7 +1441,7 @@ public final class Bitmap implements Parcelable {
* @throws ArrayIndexOutOfBoundsException if the pixels array is too small
* to receive the specified number of pixels.
*/
public void setPixels(int[] pixels, int offset, int stride,
public void setPixels(@ColorInt int[] pixels, int offset, int stride,
int x, int y, int width, int height) {
checkRecycled("Can't call setPixels() on a recycled bitmap");
if (!isMutable()) {