To prepare the surface:
this.surface = (SurfaceView)findViewById(R.id.yourSurface);
this.surfaceHolder = this.surface.getHolder();
this.surfaceHolder.addCallback(this);
this.surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
To start the camera:
this.camera = Camera.open()
this.camera.setPreviewDisplay(this.surfaceHolder);
Camera.parameters parameters = this.camera.getParameters();
parameters.getPreviewSize(x, y);
this.camera.startPreview();
To reset or pause the camera:
this.camera.stopPreview();
this.camera.release();
To take a picture:
this.camera.takePicture(shutterCallback, rawCallback, jpegCallback);
To check SD card inside:
android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
To save picture:
Bitmap bm = BitmapFactory.decodeByteArray(_data, 0, _data.length);
File myCaptureFile = new File(strCaptureFilePath);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
2012年4月8日星期日
2011年7月19日星期二
[Linux] VirtualBox里debian的分辨率修改
之前使用VirtualBox安装debian,发现没有办法改分辨率,很难受。
经过查找,找到了x-windows修改分辨率的方法:
使用gtf 1280 800 60得到要修改的代码,修改/etc/X11/xorg.conf如下:
Section "Monitor"
Identifier "Configured Monitor"
Option "DPMS"
Modeline "1280x800_60.00" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
Modeline "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
SubSection "Display"
Modes "1280x1024_60.00" "1024x768_60.00"
EndSubSection
EndSection
经过查找,找到了x-windows修改分辨率的方法:
使用gtf 1280 800 60得到要修改的代码,修改/etc/X11/xorg.conf如下:
Section "Monitor"
Identifier "Configured Monitor"
Option "DPMS"
Modeline "1280x800_60.00" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
Modeline "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
SubSection "Display"
Modes "1280x1024_60.00" "1024x768_60.00"
EndSubSection
EndSection
订阅:
博文 (Atom)