本文整理汇总了Java中com.adobe.fre.FREBitmapData类的典型用法代码示例。如果您正苦于以下问题:Java FREBitmapData类的具体用法?Java FREBitmapData怎么用?Java FREBitmapData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FREBitmapData类属于com.adobe.fre包,在下文中一共展示了FREBitmapData类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAttachmentImages
import com.adobe.fre.FREBitmapData; //导入依赖的package包/类
private VKUploadImage[] getAttachmentImages( FREArray attachmentImages ) {
if( attachmentImages == null ) return null;
try {
long length = attachmentImages.getLength();
VKUploadImage[] result = new VKUploadImage[(int)length];
for( int i = 0; i < length; i++ ) {
FREBitmapData bmpData = (FREBitmapData) attachmentImages.getObjectAt( i );
Bitmap bitmap = BitmapDataUtils.getBitmap( bmpData );
result[i] = new VKUploadImage( bitmap, VKImageParameters.pngImage() );
}
return result;
} catch( Exception e ) {
e.printStackTrace();
AIR.log( "Error parsing attachment images: " + e.getLocalizedMessage() );
return null;
}
}
开发者ID:marpies,项目名称:vk-ane,代码行数:19,代码来源:ShareFunction.java
示例2: getBitmap
import com.adobe.fre.FREBitmapData; //导入依赖的package包/类
/**
* Switch color channels
* http://stackoverflow.com/questions/17314467/bitmap-channels-order-different-in-android
*/
public static Bitmap getBitmap( FREBitmapData bitmapData ) throws FREWrongThreadException, FREInvalidObjectException {
bitmapData.acquire();
Bitmap bitmap = Bitmap.createBitmap( bitmapData.getWidth(), bitmapData.getHeight(), Bitmap.Config.ARGB_8888 );
Canvas canvas = new Canvas( bitmap );
Paint paint = new Paint();
paint.setColorFilter( mColorFilter );
bitmap.copyPixelsFromBuffer( bitmapData.getBits() );
bitmapData.release();
canvas.drawBitmap( bitmap, 0, 0, paint );
return bitmap;
}
开发者ID:marpies,项目名称:face-detection-ane,代码行数:16,代码来源:BitmapDataUtils.java
示例3: getBitmapFromFREBitmapData
import com.adobe.fre.FREBitmapData; //导入依赖的package包/类
protected Bitmap getBitmapFromFREBitmapData(FREObject object) {
Bitmap result;
try {
FREBitmapData freBitmapData = (FREBitmapData) object;
Paint paint = new Paint();
float[] bgrToRgbColorTransform =
{
0, 0, 1f, 0, 0,
0, 1f, 0, 0, 0,
1f, 0, 0, 0, 0,
0, 0, 0, 1f, 0
};
ColorMatrix colorMatrix = new ColorMatrix(bgrToRgbColorTransform);
ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
paint.setColorFilter(colorFilter);
freBitmapData.acquire();
int width = freBitmapData.getWidth();
int height = freBitmapData.getHeight();
result = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888 );
result.copyPixelsFromBuffer(freBitmapData.getBits());
freBitmapData.release();
// Convert the bitmap from BGRA to RGBA.
Canvas canvas = new Canvas(result);
canvas.drawBitmap(result, 0, 0, paint);
}
catch (Exception e) {
e.printStackTrace();
return null;
}
return result;
}
开发者ID:freshplanet,项目名称:ANE-AACPlayer,代码行数:37,代码来源:BaseFunction.java
示例4: call
import com.adobe.fre.FREBitmapData; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
AIR.log( "FaceDetection::detect" );
final int callbackId = FREObjectUtils.getInt( args[1] );
final Bitmap image;
try {
image = BitmapDataUtils.getBitmap( (FREBitmapData) args[0] );
} catch( Exception e ) {
e.printStackTrace();
AIR.log( "Error creating Bitmap out of FREBitmapData" );
AIR.dispatchEvent(
FaceDetectionEvent.FACE_DETECTION_ERROR,
StringUtils.getEventErrorJSON( callbackId, "Error creating Bitmap out of FREBitmapData" )
);
return null;
}
/* Mode (accuracy) */
final int accuracy = FREObjectUtils.getInt( args[2] ); // Comes in as a ready-to-use value
boolean detectOpenEyes = FREObjectUtils.getBoolean( args[3] );
boolean detectSmile = FREObjectUtils.getBoolean( args[4] );
final boolean prominentFaceOnly = FREObjectUtils.getBoolean( args[5] );
/* Classification type (detect open eyes, detect smile) */
final int classification = (detectOpenEyes || detectSmile) ? FaceDetector.ALL_CLASSIFICATIONS : FaceDetector.NO_CLASSIFICATIONS;
final Activity activity = AIR.getContext().getActivity();
new Thread(
new Runnable() {
@Override
public void run() {
AIR.log( "Running FaceDetection in new thread" );
FaceDetector.Builder fb = new FaceDetector.Builder( activity.getApplicationContext() );
fb.setClassificationType( classification )
.setMode( accuracy )
.setTrackingEnabled( false )
.setLandmarkType( FaceDetector.ALL_LANDMARKS ) // We want to know about eye/mouth positions
.setProminentFaceOnly( prominentFaceOnly );
/* Wrap the detector in SafeFaceDetector */
final FaceDetector detector = fb.build();
Detector<Face> sd = new SafeFaceDetector( detector );
if( !sd.isOperational() ) {
sd.release();
AIR.log( "Error, detector is not operational." );
AIR.dispatchEvent( FaceDetectionEvent.FACE_DETECTION_ERROR, "Detector is not operational. Dependencies may have not been downloaded yet. Please, try again later." );
return;
}
/* Create Frame with bitmap */
final Frame frame = new Frame.Builder().setBitmap( image ).build();
SparseArray<Face> faces = sd.detect( frame );
/* Build faces JSONArray */
JSONArray facesResult = getFacesJSONArray( faces );
dispatchResponse( facesResult, callbackId );
sd.release();
}
}
).start();
return null;
}
开发者ID:marpies,项目名称:face-detection-ane,代码行数:67,代码来源:DetectFacesFunction.java
注:本文中的com.adobe.fre.FREBitmapData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论