本文整理汇总了Java中com.android.ddmlib.RawImage类的典型用法代码示例。如果您正苦于以下问题:Java RawImage类的具体用法?Java RawImage怎么用?Java RawImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RawImage类属于com.android.ddmlib包,在下文中一共展示了RawImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScreenSizeInfo
import com.android.ddmlib.RawImage; //导入依赖的package包/类
/**
* 获取设备分辨率
*/
private void getScreenSizeInfo(){
RawImage rawScreen;
try {
rawScreen = idevice.getScreenshot();
if(rawScreen != null){
screenWidth = rawScreen.width;
screenHeight = rawScreen.height;
}else{
}
} catch (TimeoutException | AdbCommandRejectedException | IOException e) {
// TODO Auto-generated catch block
logger.error(serialNumber+":无法获取屏幕尺寸",e);
}
}
示例2: getDeviceImage
import com.android.ddmlib.RawImage; //导入依赖的package包/类
private static void getDeviceImage(IDevice device, String filepath, boolean landscape)
throws IOException {
RawImage rawImage;
try {
rawImage = device.getScreenshot();
} catch (TimeoutException e) {
printAndExit("Unable to get frame buffer: timeout", true /* terminate */);
return;
} catch (Exception ioe) {
printAndExit("Unable to get frame buffer: " + ioe.getMessage(), true /* terminate */);
return;
}
// device/adb not available?
if (rawImage == null)
return;
if (landscape) {
rawImage = rawImage.getRotated();
}
// convert raw data to an Image
BufferedImage image = new BufferedImage(rawImage.width, rawImage.height,
BufferedImage.TYPE_INT_ARGB);
int index = 0;
int IndexInc = rawImage.bpp >> 3;
for (int y = 0 ; y < rawImage.height ; y++) {
for (int x = 0 ; x < rawImage.width ; x++) {
int value = rawImage.getARGB(index);
index += IndexInc;
image.setRGB(x, y, value);
}
}
if (!ImageIO.write(image, "png", new File(filepath))) {
throw new IOException("Failed to find png writer");
}
}
示例3: ChimpRawImage
import com.android.ddmlib.RawImage; //导入依赖的package包/类
public ChimpRawImage(RawImage rawImage) {
version = rawImage.version;
bpp = rawImage.bpp;
size = rawImage.size;
width = rawImage.width;
height = rawImage.height;
red_offset = rawImage.red_offset;
red_length = rawImage.red_length;
blue_offset = rawImage.blue_offset;
blue_length = rawImage.blue_length;
green_offset = rawImage.green_offset;
green_length = rawImage.green_length;
alpha_offset = rawImage.alpha_offset;
alpha_length = rawImage.alpha_length;
data = rawImage.data;
}
示例4: toRawImage
import com.android.ddmlib.RawImage; //导入依赖的package包/类
public RawImage toRawImage() {
RawImage rawImage = new RawImage();
rawImage.version = version;
rawImage.bpp = bpp;
rawImage.size = size;
rawImage.width = width;
rawImage.height = height;
rawImage.red_offset = red_offset;
rawImage.red_length = red_length;
rawImage.blue_offset = blue_offset;
rawImage.blue_length = blue_length;
rawImage.green_offset = green_offset;
rawImage.green_length = green_length;
rawImage.alpha_offset = alpha_offset;
rawImage.alpha_length = alpha_length;
rawImage.data = data;
return rawImage;
}
示例5: ThirtyTwoBitColorModel
import com.android.ddmlib.RawImage; //导入依赖的package包/类
public ThirtyTwoBitColorModel(RawImage rawImage) {
super(32, BITS, ColorSpace.getInstance(ColorSpace.CS_sRGB),
true, false, Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
redOffset = rawImage.red_offset;
redLength = rawImage.red_length;
redMask = ImageUtils.getMask(redLength);
greenOffset = rawImage.green_offset;
greenLength = rawImage.green_length;
greenMask = ImageUtils.getMask(greenLength);
blueOffset = rawImage.blue_offset;
blueLength = rawImage.blue_length;
blueMask = ImageUtils.getMask(blueLength);
alphaLength = rawImage.alpha_length;
alphaOffset = rawImage.alpha_offset;
alphaMask = ImageUtils.getMask(alphaLength);
}
示例6: ThirtyTwoBitColorModel
import com.android.ddmlib.RawImage; //导入依赖的package包/类
public ThirtyTwoBitColorModel(RawImage rawImage) {
super(32, BITS, ColorSpace.getInstance(1000), true, false, 3, 0);
this.redOffset = rawImage.red_offset;
this.redLength = rawImage.red_length;
this.redMask = ImageUtils.getMask(this.redLength);
this.greenOffset = rawImage.green_offset;
this.greenLength = rawImage.green_length;
this.greenMask = ImageUtils.getMask(this.greenLength);
this.blueOffset = rawImage.blue_offset;
this.blueLength = rawImage.blue_length;
this.blueMask = ImageUtils.getMask(this.blueLength);
this.alphaLength = rawImage.alpha_length;
this.alphaOffset = rawImage.alpha_offset;
this.alphaMask = ImageUtils.getMask(this.alphaLength);
}
示例7: getScreenshot
import com.android.ddmlib.RawImage; //导入依赖的package包/类
@Override
public RawImage getScreenshot(long timeout, TimeUnit unit)
throws TimeoutException,
AdbCommandRejectedException,
IOException {
// TODO Auto-generated method stub
return null;
}
示例8: run
import com.android.ddmlib.RawImage; //导入依赖的package包/类
@Override
public void run() {
try {
RawImage image = myDevice.getScreenshot(10, TimeUnit.SECONDS);
myFuture.set(image);
}
catch (Throwable t) {
myFuture.setException(t);
}
}
示例9: convertImage
import com.android.ddmlib.RawImage; //导入依赖的package包/类
/**
* Convert a raw image into a buffered image.
*
* @param rawImage the raw image to convert
* @param image the old image to (possibly) recycle
* @return the converted image
*/
public static BufferedImage convertImage(RawImage rawImage, BufferedImage image) {
switch (rawImage.bpp) {
case 16:
return rawImage16toARGB(image, rawImage);
case 32:
return rawImage32toARGB(rawImage);
}
return null;
}
示例10: rawImage32toARGB
import com.android.ddmlib.RawImage; //导入依赖的package包/类
private static BufferedImage rawImage32toARGB(RawImage rawImage) {
// Do as much as we can to not make an extra copy of the data. This is just a bunch of
// classes that wrap's the raw byte array of the image data.
DataBufferByte dataBuffer = new DataBufferByte(rawImage.data, rawImage.size);
PixelInterleavedSampleModel sampleModel =
new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, rawImage.width, rawImage.height,
4, rawImage.width * 4, BAND_OFFSETS_32);
WritableRaster raster = Raster.createWritableRaster(sampleModel, dataBuffer,
new Point(0, 0));
return new BufferedImage(new ThirtyTwoBitColorModel(rawImage), raster, false, EMPTY_HASH);
}
示例11: rawImage16toARGB
import com.android.ddmlib.RawImage; //导入依赖的package包/类
private static BufferedImage rawImage16toARGB(BufferedImage image, RawImage rawImage) {
// Do as much as we can to not make an extra copy of the data. This is just a bunch of
// classes that wrap's the raw byte array of the image data.
DataBufferByte dataBuffer = new DataBufferByte(rawImage.data, rawImage.size);
PixelInterleavedSampleModel sampleModel =
new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, rawImage.width, rawImage.height,
2, rawImage.width * 2, BAND_OFFSETS_16);
WritableRaster raster = Raster.createWritableRaster(sampleModel, dataBuffer,
new Point(0, 0));
return new BufferedImage(new SixteenBitColorModel(rawImage), raster, false, EMPTY_HASH);
}
示例12: getScreenSize
import com.android.ddmlib.RawImage; //导入依赖的package包/类
@Override
public Dimension getScreenSize() {
if (this.screenSize == null) {
try {
RawImage screenshot = device.getScreenshot();
this.screenSize = new Dimension(screenshot.width,
screenshot.height);
} catch (Exception e) {
log.warn("was not able to determine screensize: "
+ e.getMessage());
}
}
return this.screenSize;
}
示例13: convertImage
import com.android.ddmlib.RawImage; //导入依赖的package包/类
public static BufferedImage convertImage(RawImage rawImage) {
switch (rawImage.bpp) {
case 16:
return rawImage16toARGB(rawImage);
case 32:
return rawImage32toARGB(rawImage);
}
return null;
}
示例14: rawImage32toARGB
import com.android.ddmlib.RawImage; //导入依赖的package包/类
private static BufferedImage rawImage32toARGB(RawImage rawImage) {
DataBufferByte dataBuffer = new DataBufferByte(rawImage.data,
rawImage.size);
PixelInterleavedSampleModel sampleModel = new PixelInterleavedSampleModel(
0, rawImage.width, rawImage.height, 4, rawImage.width * 4,
BAND_OFFSETS_32);
WritableRaster raster = Raster.createWritableRaster(sampleModel,
dataBuffer, new Point(0, 0));
return new BufferedImage(new ThirtyTwoBitColorModel(rawImage), raster,
false, EMPTY_HASH);
}
示例15: rawImage16toARGB
import com.android.ddmlib.RawImage; //导入依赖的package包/类
private static BufferedImage rawImage16toARGB(RawImage rawImage) {
DataBufferByte dataBuffer = new DataBufferByte(rawImage.data,
rawImage.size);
PixelInterleavedSampleModel sampleModel = new PixelInterleavedSampleModel(
0, rawImage.width, rawImage.height, 2, rawImage.width * 2,
BAND_OFFSETS_16);
WritableRaster raster = Raster.createWritableRaster(sampleModel,
dataBuffer, new Point(0, 0));
return new BufferedImage(new SixteenBitColorModel(rawImage), raster,
false, EMPTY_HASH);
}