org.beigesoft.graphic.model.AndroidImage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beige-graphic-android Show documentation
Show all versions of beige-graphic-android Show documentation
This is delegators that implements graphic logic (read image from file...) with Android.
The newest version!
package org.beigesoft.graphic.model;
/*
* Copyright (c) 2017 Beigesoft ™
*
* Licensed under the GNU General Public License (GPL), Version 2.0
* (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
*/
import android.graphics.Bitmap;
/**
* Android image wrapper.
*
* @author Yury Demidenko
*/
public class AndroidImage implements IImageRgb {
/**
* Wrapped Android image.
**/
private final Bitmap image;
/**
* Setter for image.
* @param pImage reference
**/
public AndroidImage(final Bitmap pImage) {
this.image = pImage;
}
/**
* Getter for image width.
* @return int
**/
@Override
public final int getWidth() {
return this.image.getWidth();
}
/**
* Getter for image height.
* @return int
**/
@Override
public final int getHeight() {
return this.image.getHeight();
}
/**
*
* Get pixel ARGB integer value.
*
* @param pX - X
* @param pY - Y
* @return int ARGB bytes.
**/
@Override
public final int getRgb(final int pX, final int pY) {
return this.image.getPixel(pX, pY);
}
/**
*
* Set pixel ARGB.
*
* @param pX - X
* @param pY - Y
* @param pRgb ARGB bytes.
**/
@Override
public final void setRgb(final int pX, final int pY,
final int pRgb) {
this.image.setPixel(pX, pY, pRgb);
}
//SGS:
/**
* Getter for image.
* @return Bitmap
**/
public final Bitmap getImage() {
return this.image;
}
}