surfaceview

Color banding and artifacts with gradients despite using RGBA_8888 everywhere

十年热恋 提交于 2019-11-29 16:09:15
问题 I'm aware that colour banding is an old chestnut of a problem that has been discussed many times before with various solutions provided (which essentially boil down to use 32-bit throughout, or use dithering). In fact not so long ago I asked and subsequently answered my own SO question regarding this. Back then, I thought that the solution I put in the answer to that question (which is to apply setFormat(PixelFormat.RGBA_8888) to the Window and also to the Holder in the case of a SurfaceView

ugly fragment transition to surfaceview with overlay

那年仲夏 提交于 2019-11-29 15:36:13
My app one of the fragments draws a map in a surface view with an overlay for buttons and text. Most of the other fragments are lists. My problem is that during the transition between the map and another fragment, ugly black rectangles momentarily appear in the map view where the text and button views are placed. This appears more pronounced on a transition back to the map, although it does happen in both directions. I am using a slide-left/slide-right animation which works nicely in all other respects. I've tried other animations and no animation. Setting the text and buttons invisible before

Resizing surface view for aspect ratio change in video display in android

こ雲淡風輕ζ 提交于 2019-11-29 12:39:19
问题 I am working on a video conferencing project. My video display is using surface view. Now during a video call there is a chance of aspect ratio change for the incoming frames. So i have tried the following code for it public void surfaceResize() { // WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Point size = new Point(); int screenWidth = 0; //Get the SurfaceView layout parameters float aspectRatio = (float) recv_frame_width / recv_frame_height; if

Android之调用本地摄像头

房东的猫 提交于 2019-11-29 12:19:42
做应用可能有时候需要调用本地的摄像头,所以这里就记录意下如何调用。 摄像头预览需要在布局文件添加surfaceview, 这里需要注意,其实用FrameLayout也可以,大家可以参考 http://www.cnblogs.com/over140/archive/2011/11/16/2251344.html 1、布局 <SurfaceView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/surfaceview"/> 只要在布局文件添加这个即可。 2、摄像头预览 public class MainActivity extends Activity implements SurfaceHolder.Callback 继承Activity,实现SurfaceHolder.Callback,MainActivity里需要我们复写以下几个方法: @Override public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) { System.out.println("surfacechanged"); } @Override public void

Camera preview stretched even after setting the correct dimensions

大城市里の小女人 提交于 2019-11-29 11:19:42
问题 I'm creating a camera app that implements it's own camera preview for taking pictures. The app is currently forced into portrait mode. My problem is that the preview from the camera is slightly stretched (the aspect ratio is a bit off). The funny thing is that I'm setting my SurfaceView size to always match the preview size. This ensures that the aspect ratio should always be perserved... but it isn't... Here is the layout i use to show my camera preview: public class Cp extends ViewGroup

SurfaceView shows black screen - Android

会有一股神秘感。 提交于 2019-11-29 10:08:06
Basically I want to use SurfaceView for animation. Therefore the class implements Runnable. To experiment, I want to draw a circle. However, it shows only a black screen. I have been trying for days. Really appreciate if someone can help. MainActivity class public class MainActivity extends Activity { private Bitmap Liquid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature (Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DrawStripFrame D1

How to properly use setZOrderMediaOverlay on Android?

萝らか妹 提交于 2019-11-29 09:33:02
问题 Like many others, I am trying to draw 3D objects (using GLSurfaceView) on camera preview (using SurfaceView), along with some buttons placed on top. I actually got a prototype working, but I could not get the onResume working correctly. After a resume, GLSurfaceView stays behind and is not visible anymore. I know that it is working, because I can see the drawing fine if I remove the SurfaceView from the layout. The target is Nexus One, running stock 2.3.3 ROM. Here's the layout xml: <com

How to make SurfaceView with transparent background?

拟墨画扇 提交于 2019-11-29 09:03:41
问题 I have simple layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/backgroundtimer" android:orientation="vertical" > <TextView android:id="@+id/TextView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop

Setting image background in SurfaceView, getting black screen

 ̄綄美尐妖づ 提交于 2019-11-29 08:41:42
Okay so Im trying to set the background of a SurfaceView to a JPG file. But it doesn't seem to want to draw the image, and all I get is a black screen. Here:s my code: public class FloorplanActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MapView mapView = new MapView(getApplicationContext()); setContentView(mapView); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.floorplan, menu); return true; }

Drawing scaled bitmaps on a SurfaceView — no antialiasing

£可爱£侵袭症+ 提交于 2019-11-29 07:49:31
I'm sorry if this topic has been brought before, but all my searches on the web and google groups did not help me. I'm currently developing a little game with the Android SDK, and use hi-res bitmaps that I resize accordingly to match the device's resolution (letting the system do it for me is not "crisp" enough). I use a SurfaceView, on which I paint in one pass a canvas filling the whole surface. The paint uses setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)) to allow masking. Beforehand, I retrieve various bitmaps -- which are resized at initialization with createScaledBitmap()