Java Code Examples for android.view.SurfaceHolder#setFormat()

The following examples show how to use android.view.SurfaceHolder#setFormat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchView.java    From brailleback with Apache License 2.0 6 votes vote down vote up
public SearchView(Context context, StringBuilder queryText) {
    super(context);

    mContext = context;
    mQueryText = queryText;

    mPaint = new Paint();
    mPaint.setAntiAlias(true);

    final SurfaceHolder holder = getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);
    holder.addCallback(mSurfaceCallback);

    final Resources res = context.getResources();

    int mExtremeRadius = 128;

    // Gradient colors.
    final int gradientInnerColor = res.getColor(R.color.search_overlay);
    final int gradientOuterColor = res.getColor(R.color.search_overlay);
    final int[] colors = new int[] {gradientInnerColor, gradientOuterColor};
    mGradientBackground =
            new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    mGradientBackground.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
Example 2
Source File: FaceDetectRGBActivity.java    From FaceDetectCamera with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    SurfaceHolder holder = mView.getHolder();
    holder.addCallback(this);
    holder.setFormat(ImageFormat.NV21);
}
 
Example 3
Source File: GameView.java    From wearabird with MIT License 5 votes vote down vote up
private void init(@SuppressWarnings("UnusedParameters") Context context) {
	SurfaceHolder holder = getHolder();
	holder.addCallback(this);
	holder.setFormat(PixelFormat.RGBA_8888);
	setKeepScreenOn(true);
	mainThreadHandler = new Handler(Looper.getMainLooper());
}
 
Example 4
Source File: LoadingAnimationSurfaceView.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void surfaceCreated(SurfaceHolder holder) {
     this.holder = holder;
     holder.setFormat(PixelFormat.TRANSLUCENT);
     isCreatedFlag = true;
     Log.d("Loading","surfaceCreated");
 }
 
Example 5
Source File: LoadingAnimationSurfaceView.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    this.holder = holder;
    holder.setFormat(PixelFormat.TRANSLUCENT);

    Log.d("Loading","surfaceChanged");
}
 
Example 6
Source File: SquareMotionView.java    From ToyView with MIT License 5 votes vote down vote up
private void initPaint() {
    SurfaceHolder holder = getHolder();
    holder.addCallback(this);
    holder.setFormat(PixelFormat.TRANSPARENT);
    setZOrderOnTop(true);

    linePaint.setAntiAlias(true);
    linePaint.setColor(0xff05225C);
    linePaint.setStyle(Paint.Style.STROKE);
    linePaint.setStrokeCap(Paint.Cap.ROUND);
    linePaint.setStrokeWidth(20);

}
 
Example 7
Source File: ScratchOutView.java    From Android-ScratchOutView with MIT License 5 votes vote down vote up
private void init() {

        setZOrderOnTop(true);
        SurfaceHolder holder = getHolder();
        holder.addCallback(this);
        holder.setFormat(PixelFormat.TRANSPARENT);

        overlayPaint = new Paint();
        overlayPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
        overlayPaint.setStyle(Paint.Style.STROKE);
        overlayPaint.setStrokeCap(Paint.Cap.ROUND);
        overlayPaint.setStrokeJoin(Paint.Join.ROUND);

    }