求这张图三张相框怎样挂好看里的图

已解决问题
找一个可以给图片加相框得工具,要求好看的!相框要多!
找一个可以给图片加相框得工具,要求好看的!相框要多!
我用过9158虚拟视频,但里边得相框都不大好看
太花花 问题补充:再补充一句,要免费的!
影楼那样的
浏览次数:1792
用手机阿里扫一扫
最满意答案
推荐用彩影2008就很好用咯~~不但相框多而且好看,还可以添加饰物、蒙板以及各种图片处理操作,易用而且效果好,是图象处理软件里不可缺少的软件咯用久了觉得挺实用的,呵呵~参考资料:http://news.newhua.com/news1/industry/EEDKA7G180I220H9C8.html&
答案创立者
以企业身份回答&
正在进行的活动
生意经不允许发广告,违者直接删除
复制问题或回答,一经发现,拉黑7天
快速解决你的电商难题
店铺优化排查提升2倍流量
擅长&nbsp 店铺优化
您可能有同感的问题
扫一扫用手机阿里看生意经
问题排行榜
当前问题的答案已经被保护,只有知县(三级)以上的用户可以编辑!写下您的建议,管理员会及时与您联络!
server is ok#d1{width:<span style="color: #0;height:<span style="color: #0;border:<span style="color: # gray solid}
&div id=d1&&/div&
&input type=button id=bn1 value=change&
&span id=s1&&/span&
&script language="JavaScript"&
'http://www.biaoqing1.com/uploads/allimg/T3B08-2.gif',
'http://www.biaoqing1.com/uploads/allimg/T31E0-14.gif',
'http://biaoqing1.com/uploads/allimg/T35102-12.gif',
'http://biaoqing1.com/uploads/allimg/T34R4-0.gif'
var i=<span style="color: #;
d1.style.background='URL('+a[i]+') no-repeat';
bn1.onclick=function(){
++i&=a.length?i=<span style="color: #:<span style="color: #;
d1.style.background='URL('+a[i]+') no-repeat';
s1.innerText=i;
阅读(...) 评论()请问谁有这张图片的原图?(框框里面的)_百度知道
请问谁有这张图片的原图?(框框里面的)
请问谁有这张图片的原图?(框框里面的)好的话必采纳重谢!...
请问谁有这张图片的原图?(框框里面的)好的话必采纳
&#xe6b9;答题抽奖
首次认真答题后
即可获得3次抽奖机会,100%中奖。
采纳数:52
获赞数:102
为你推荐:
其他类似问题
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。求一张,两个相框一朵花,一个人,海边图片。上面还有四行字!_百度知道
求一张,两个相框一朵花,一个人,海边图片。上面还有四行字!
&#xe6b9;答题抽奖
首次认真答题后
即可获得3次抽奖机会,100%中奖。
是这个吗?&&&&&&&&&& 采纳&&& 采纳
为你推荐:
其他类似问题
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。自定义相机截取选取框中的图片
先上一张效果图:
使用自定义相机我们需要知道这3个类:
android.hardware.Camera
//相机的实例
android.view.SurfaceView
//用来展示相机预览画面的控件
android.view.SurfaceHolder //通过这个类将Camera和SurfaceView之间建立连接
重点要点:
添加权限。
uses-feature android:name=”android.hardware.camera”
uses-feature android:name=”android.hardware.camera.autofocus”
uses-permission android:name=”android.permission.CAMERA”
自定义相机要想正常在手机上显示预览画面,点击拍照后能够获取到正常的图片,还需要设置Camera对象的一系列参数。通过camera.getParameters()获得Parameters对象设置参数。
需要明白三种尺寸:
1.Surfaceview的尺寸
Surfaceview是用来展示Camera预览画面的,当它全屏时就是Screen的大小。
2.Picturesize的尺寸
这是拍照后得到的照片尺寸。
3.Previewsize的尺寸
这是预览时Camera预览画面的尺寸。
三种变形 :
1.预览画面的物体长宽失真。原因是Surfaceview和Previewsize的长宽比率不一致,就会导致预览画面上失真。因为camera在显示时会将预览帧数据缩放成Surfaceview大小,当比率不一致必然会物体变形。至于这个缩放算法可能不同手机得到的结果不同。
2.拍照后照片上物体变形。
3.点击拍照瞬间,预览画面上会突然变形然后恢复到正常预览。
2、3两种变形都是因为Previewsize和Picturesize的长宽比率不一致所致。总之一句话,为了保证图片不是真,要保证预览Surfaceview、Previewsize、Picturesize的长宽比率要一直。如果Surfaceview是全屏的话,要获取屏幕长和宽得到比率。
在设置setPreviewSize和setPictureSize时个人觉得主要遵循一个原则:保证setPreviewSize,setPictureSize和Surfaceview的分辨率的长宽比三者尽量一致。这样预览的时候就不会变形,得到的照片也许分辨率尺寸不同但是长宽比例是一致的,这样我们就可以根据Surfaceview与照片之间的缩放比计算出实际要截取的位置起点和大小。大家可以根据这个原则去改善获取最佳分辨率的算法,我的是我自己根据这个思路去改写的。但是还是存一些问题。
camera2.xml
自定义相机布局文件
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"&
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" /&
android:id="@+id/camera_header_bar"
layout="@layout/camera_header_bar" /&
android:id="@+id/camera_bottom_bar"
layout="@layout/camera_bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" /&
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:visibility="gone"/&
CustomCamera2 .java
自定义相机界面
public class CustomCamera2 extends Activity implements View.OnClickListener, OnCaptureCallback {
private MaskSurfaceView surfaceView
private ImageView flashSwitch
private ImageView result
private CameraHelper helper
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState)
requestWindowFeature(Window.FEATURE_NO_TITLE)
setContentView(R.layout.camera2)
//获取相机拍取图片类型
Intent intent = getIntent()
int imagetype = intent.getIntExtra(IMAGE_TYPE, -1)
String imagepatch = intent.getStringExtra("IMAGEPATCH")
//初始化surfaceView,设置照片保存路径
surfaceView = (MaskSurfaceView) findViewById(R.id.container)
surfaceView.setResourceid(R.drawable.idborder1)
if (imagetype==0){
surfaceView.setResourceid(R.drawable.idborder1)
}else if (imagetype==1){
surfaceView.setResourceid(R.drawable.idborder2)
surfaceView.setMaskSize((int) ScreenUtil.dpToPx(this, 252), (int) ScreenUtil.dpToPx(this, 400))
surfaceView.setOnClickListener(this)
helper = CameraHelper.getInstance()
helper.setPictureSaveDictionaryPath("/storage/emulated/0/DCIM/test")
//拍照结果
result = (ImageView) findViewById(R.id.result)
result.setOnClickListener(this)
//初始化拍照按钮
ImageButton takePicture = (ImageButton) findViewById(R.id.btn_shutter_camera)
takePicture.setOnClickListener(this)
//初始化闪光灯开个按钮
flashSwitch = (ImageView) findViewById(R.id.btn_flash_mode)
flashSwitch.setOnClickListener(this)
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_shutter_camera:
CameraHelper.getInstance().tackPicture(CustomCamera2.this)
case R.id.btn_flash_mode:
if (helper.getFlashMode() == CameraHelper.FlashMode.ON) {
helper.setFlashMode(CameraHelper.FlashMode.OFF)
flashSwitch.setImageResource(R.drawable.btn_flash_off)
} else if (helper.getFlashMode() == CameraHelper.FlashMode.OFF) {
helper.setFlashMode(CameraHelper.FlashMode.AUTO)
flashSwitch.setImageResource(R.drawable.btn_flash_auto)
} else if (helper.getFlashMode() == CameraHelper.FlashMode.AUTO) {
helper.setFlashMode(CameraHelper.FlashMode.TORCH)
flashSwitch.setImageResource(R.drawable.btn_flash_torch)
} else if (helper.getFlashMode() == CameraHelper.FlashMode.TORCH) {
helper.setFlashMode(CameraHelper.FlashMode.ON)
flashSwitch.setImageResource(R.drawable.btn_flash_on)
case R.id.container:
CameraHelper.getInstance().AutoFocus(null)
case R.id.result:
result.setVisibility(View.GONE)
surfaceView.setVisibility(View.VISIBLE)
CameraHelper.getInstance().startPreview()
public void onCapture(boolean success, String filePath) {
String filepath = filePath
String message = "拍照成功"
if (!success) {
message = "拍照失败"
CameraHelper.getInstance().startPreview()
this.result.setVisibility(View.GONE)
this.surfaceView.setVisibility(View.VISIBLE)
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
this.result.setVisibility(View.VISIBLE)
this.surfaceView.setVisibility(View.GONE)
this.result.setImageBitmap(BitmapFactory.decodeFile(filepath))
Toast.makeText(this, message + "\r\n" + filepath, Toast.LENGTH_SHORT).show()
CameraHelper.java
业务逻辑放在此类中操作
public class CameraHelper {
private final String TAG = "CameraHelper";
private ToneG
private String fileP
private boolean isP
final double ASPECT_TOLERANCE = 0.15;
private static CameraH
private MaskSurfaceView surfaceV
private int picQuality = 100;
private Size pictureS
private FlashMode mFlashMode = FlashMode.ON;
private CameraHelper() {
public static synchronized CameraHelper getInstance() {
if (helper == null) {
helper = new CameraHelper();
* 设置照片质量
* picQuality
public CameraHelper setPicQuality(int picQuality) {
this.picQuality = picQ
*: 闪光灯类型枚举 默认为关闭
public enum FlashMode {
* ON:拍照时打开闪光灯
* OFF:不打开闪光灯
* AUTO:系统决定是否打开闪光灯
* TORCH:一直打开闪光灯
* 获取当前闪光灯类型
public FlashMode getFlashMode() {
return mFlashM
* 设置闪光灯类型
* flashMode
public void setFlashMode(FlashMode flashMode) {
if (camera == null) return;
mFlashMode = flashM
Camera.Parameters parameters = camera.getParameters();
switch (flashMode) {
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
case AUTO:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
case TORCH:
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
camera.setParameters(parameters);
* 设置文件保存路径(default: /mnt/sdcard/DICM)
public CameraHelper setPictureSaveDictionaryPath(String path) {
this.filePath =
public CameraHelper setMaskSurfaceView(MaskSurfaceView surfaceView) {
this.surfaceView = surfaceV
* 打开相机并开启预览
SurfaceHolder
SurfaceView宽度
SurfaceView高度
* screenWidth
* screenHeight 屏幕高度
public void openCamera(SurfaceHolder holder, int format, int width, int height, int screenWidth, int screenHeight) {
if (this.camera != null) {
this.camera.release();
this.camera = Camera.open();
this.initParameters(holder, format, width, height, screenWidth, screenHeight);
this.startPreview();
public void AutoFocus(final OnCaptureCallback callback) {
this.camera.autoFocus(new AutoFocusCallback() {
public void onAutoFocus(boolean success, Camera camera) {
if (callback != null) {
camera.takePicture(null, null, new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
String filepath = savePicture(data);
boolean success = false;
if (filepath != null) {
success = true;
stopPreview();
callback.onCapture(success, filepath);
@SuppressWarnings("deprecation")
public void tackPicture(final OnCaptureCallback callback) {
AutoFocus(callback);
* 裁剪并保存照片
private String savePicture(byte[] data) {
File imgFileDir = getImageDir();
if (!imgFileDir.exists() && !imgFileDir.mkdirs()) {
return null;
String imgFilePath = imgFileDir.getPath() + File.separator + this.generateFileName();
Bitmap b = this.cutImage(data);
int byteCount = b.getByteCount();
File imgFile = new File(imgFilePath);
FileOutputStream fos = null;
BufferedOutputStream bos = null;
fos = new FileOutputStream(imgFile);
bos = new BufferedOutputStream(fos);
b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
} catch (Exception error) {
return null;
} finally {
if (fos != null) {
fos.flush();
fos.close();
if (bos != null) {
bos.flush();
bos.close();
} catch (IOException e) {
return imgFileP
* 生成图片名称
private String generateFileName() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss", Locale.getDefault());
String strDate = dateFormat.format(new Date());
return "img_" + strDate + ".jpg";
private File getImageDir() {
String path = null;
if (this.filePath == null || this.filePath.equals("")) {
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getPath();
path = Environment.getExternalStorageDirectory().getPath() + fileP
File file = new File(path);
if (!file.exists()) {
file.mkdir();
* 初始化相机参数
SurfaceHolder
SurfaceView宽度
SurfaceView高度
* screenWidth
* screenHeight 屏幕高度
private void initParameters(SurfaceHolder holder, int format, int width, int height, int screenWidth,
int screenHeight) {
Parameters p = this.camera.getParameters();
this.camera.setPreviewDisplay(holder);
if (width & height) {
this.camera.setDisplayOrientation(0);
this.camera.setDisplayOrientation(90);
p.set("jpeg-quality", picQuality);
p.setPictureFormat(PixelFormat.JPEG);
p.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
List&Size& previewSizes = p.getSupportedPreviewSizes();
if (this.resolution == null) {
this.resolution = this.getOptimalPreviewSize(previewSizes, width, height);
p.setPreviewSize(this.resolution.width, this.resolution.height);
} catch (Exception e) {
Log.e(TAG, "不支持的相机预览分辨率: " + this.resolution.width + " × " + this.resolution.height);
if (this.pictureSize == null) {
List&Size& pictureSizes = p.getSupportedPictureSizes();
pictureSize = setPicutreSize(pictureSizes, screenWidth, screenHeight);
p.setPictureSize(this.pictureSize.width, this.pictureSize.height);
} catch (Exception e) {
Log.e(TAG, "不支持的照片尺寸: " + this.pictureSize.width + " × " + this.pictureSize.height);
this.camera.setParameters(p);
} catch (Exception e) {
Log.e(TAG, "相机参数设置错误");
* 释放Camera
public void releaseCamera() {
if (this.camera != null) {
if (this.isPreviewing) {
this.stopPreview();
this.camera.setPreviewCallback(null);
isPreviewing = false;
this.camera.release();
this.camera = null;
* 停止预览
private void stopPreview() {
if (this.camera != null && this.isPreviewing) {
this.camera.stopPreview();
this.isPreviewing = false;
* 开始预览
public void startPreview() {
if (this.camera != null) {
this.camera.startPreview();
this.camera.autoFocus(null);
this.isPreviewing = true;
* 裁剪照片
private Bitmap cutImage(byte[] data) {
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
if (this.surfaceView.getWidth() & this.surfaceView.getHeight()) {
Matrix matrix = new Matrix();
matrix.reset();
matrix.setRotate(90);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
if (this.surfaceView == null) {
int[] sizes = this.surfaceView.getMaskSize();
if (sizes[0] == 0 || sizes[1] == 0) {
double scalex = (double)bitmap.getWidth()/sizes[2];
double scaley = (double)bitmap.getHeight()/sizes[3];
if(scalex&scaley){
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int x = (sizes[2] - sizes[0]) / 2;
int y = (sizes[3] - sizes[1]) / 2;
int realX = (int) (x*scale);
int realY = (int) (y*scale);
int realWidth = (int) (sizes[0]*scale);
int realHeight = (int) (sizes[1]*scale);
Matrix matrix = new Matrix();
matrix.reset();
matrix.setRotate(-90);
if (realX & 0 || realY & 0||realX+realWidth&bitmap.getWidth()||realY+realHeight&bitmap.getHeight()) {
return Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
return Bitmap.createBitmap(bitmap, realX, realY, realWidth, realHeight, matrix, true);
* 获取最佳预览尺寸,主要是要保持相机预览尺寸和surfaceView的宽高比一致,不然会在预览画面的时候出现失真。
* surfaceView一般是设置全屏的,而且方向是竖直方向所以一般width小于height。
* 然而相机PreviewSize一般是默认横屏的所以一般height小于width,此处计算比率需要调换位置。
* 此处计算以PreviewSize的横屏方向为标准。
private Size getOptimalPreviewSize(List&Size& sizes, int width, int height) {
Size widthMinSize = null;
Size HeightMinSize = null;
double minDiff = Double.MAX_VALUE;
double widthMinDiff = Double.MAX_VALUE;
double heightMinDiff = Double.MAX_VALUE;
double surfaceRato = (double) height /
int surfaceWidth =
int surfaceHeight =
if (sizes == null)
return null;
for (Size size : sizes) {
double previewRato = (double) size.width / size.
if (Math.abs(previewRato - surfaceRato) & ASPECT_TOLERANCE)
if (Math.abs(size.width - surfaceHeight) & widthMinDiff) {
widthMinSize =
widthMinDiff = Math.abs(size.width - surfaceHeight);
if (Math.abs(size.height - surfaceWidth) & heightMinDiff) {
HeightMinSize =
heightMinDiff = Math.abs(size.height - surfaceWidth);
if (widthMinSize != HeightMinSize) {
Log.i("MaskSurfaceView", "widthMinSize:
" + widthMinSize.width + "*" + widthMinSize.height + "\r\n" + "HeightMinSize:
" + HeightMinSize.width + "*" + HeightMinSize.height);
if (widthMinDiff & heightMinDiff) {
return widthMinS
return HeightMinS
if (null!=widthMinSize){
return widthMinS
for (Size size : sizes) {
double picutreRato = (double) size.width / size.
if (Math.abs(size.width - surfaceHeight) & widthMinDiff) {
widthMinSize =
widthMinDiff = Math.abs(size.width - surfaceHeight);
if (Math.abs(size.height - surfaceWidth) & heightMinDiff) {
HeightMinSize =
heightMinDiff = Math.abs(size.height - surfaceWidth);
if (widthMinDiff & heightMinDiff) {
return widthMinS
return HeightMinS
* 设置照片尺寸为最接近屏幕尺寸
private Size setPicutreSize(List&Size& list, int screenWidth, int screenHeight) {
Size widthMinSize = null;
Size HeightMinSize = null;
double widthMinDiff = Double.MAX_VALUE;
double heightMinDiff = Double.MAX_VALUE;
double screenRato = (double) screenHeight / screenW
for (Size size : list) {
double picutreRato = (double) size.width / size.
if (Math.abs(picutreRato - screenRato) & ASPECT_TOLERANCE)
if (Math.abs(size.width - screenHeight) & widthMinDiff) {
widthMinSize =
widthMinDiff = Math.abs(size.width - screenHeight);
if (Math.abs(size.height - screenWidth) & heightMinDiff) {
HeightMinSize =
heightMinDiff = Math.abs(size.height - screenWidth);
if (widthMinSize != HeightMinSize) {
Log.i("MaskSurfaceView", "widthMinSize:
" + widthMinSize.width + "*" + widthMinSize.height + "\r\n" + "HeightMinSize:
" + HeightMinSize.width + "*" + HeightMinSize.height);
if (widthMinDiff & heightMinDiff) {
return widthMinS
return HeightMinS
if (null!=widthMinSize){
return widthMinS
for (Size size : list) {
double picutreRato = (double) size.width / size.
if (Math.abs(size.width - screenHeight) & widthMinDiff) {
widthMinSize =
widthMinDi
f = Math.abs(size.width - screenHeight);
if (Math.abs(size.height - screenWidth) & heightMinDiff) {
HeightMinSize =
heightMinDiff = Math.abs(size.height - screenWidth);
if (widthMinDiff & heightMinDiff) {
return widthMinS
return HeightMinS
MaskSurfaceView.java
用来显示相机预览画面的控件
public class MaskSurfaceView extends FrameLayout {
private MSurfaceView surfaceV
private MaskView imageV
private int
private int
private int maskW
private int maskH
private int screenW
private int screenH
private int resourceid = -1;
public int getResourceid() {
public void setResourceid(int resourceid) {
this.resourceid =
public MaskSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
surfaceView = new MSurfaceView(context);
imageView = new MaskView(context);
this.addView(surfaceView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.addView(imageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
screenHeight = display.getHeight();
screenWidth = display.getWidth();
CameraHelper.getInstance().setMaskSurfaceView(this);
public void setMaskSize(Integer width, Integer height) {
maskHeight =
maskWidth =
public int[] getMaskSize() {
return new MaskSize().
private class MSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceH
public MSurfaceView(Context context) {
super(context);
this.holder = this.getHolder();
this.holder.setFormat(PixelFormat.TRANSPARENT);
this.holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
this.holder.addCallback(this);
public void surfaceCreated(SurfaceHolder holder) {
Log.i("MaskSurfaceView", "surfaceCreated");
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Log.i("MaskSurfaceView", "surfaceChanged");
Log.i("MaskSurfaceView", "screenWidth:
" + screenWidth + "\r\n" + "screenHeight:
" + screenHeight + "\r\n"
" + width + "\r\n" + "height:
" + height);
CameraHelper.getInstance().openCamera(holder, format, width, height, screenWidth, screenHeight);
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i("MaskSurfaceView", "surfaceDestroyed");
CameraHelper.getInstance().releaseCamera();
private class MaskSize {
private int[]
private MaskSize() {
this.size = new int[] { maskWidth, maskHeight, width, height };
private class MaskView extends ImageView {
private Paint lineP
private Paint rectP
public MaskView(Context context) {
super(context);
linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
linePaint.setStyle(Style.STROKE);
linePaint.setStrokeWidth(3f);
linePaint.setAlpha(100);
protected void onDraw(Canvas canvas) {
if (resourceid!=-1){
if (maskHeight == 0 && maskWidth == 0) {
if (maskHeight == height || maskWidth == width) {
if ((height & width && maskHeight & maskWidth) || (height & width && maskHeight & maskWidth)) {
int temp = maskH
maskHeight = maskW
maskWidth =
int h = Math.abs((height - maskHeight) / 2);
int w = Math.abs((width - maskWidth) / 2);
Rect rectf = new Rect(w,h,w + maskWidth, h + maskHeight);
InputStream is = this.getResources().openRawResource(resourceid);
BitmapFactory.Options options=new BitmapFactory.Options();
options.inJustDecodeBounds = false;
options.inSampleSize = 1;
Bitmap bitmap =BitmapFactory.decodeStream(is,null,options);
canvas.drawBitmap(bitmap,null,rectf,linePaint);
if(!bitmap.isRecycled()){
bitmap.recycle();
System.gc();
super.onDraw(canvas);
ScreenUtil.java
一个屏幕工具类
* Created by Silence on .
import android.app.A
import android.content.C
import android.graphics.P
import android.util.DisplayM
import android.view.WindowM
public class ScreenUtil {
public ScreenUtil() {
public static float dpToPx(Context context, float dp) {
return context == null?-1.0F:dp * context.getResources().getDisplayMetrics().
public static float pxToDp(Context context, float px) {
return context == null?-1.0F:px / context.getResources().getDisplayMetrics().
public static float pxToSp(Context context, float pxValue) {
if(context == null) {
return -1.0F;
float fontScale = context.getResources().getDisplayMetrics().scaledD
return pxValue / fontScale + 0.5F;
public static float spToPx(Context context, float spValue) {
if(context == null) {
return -1.0F;
float fontScale = context.getResources().getDisplayMetrics().scaledD
return spValue * fontScale + 0.5F;
public static DisplayMetrics getDisplayMetrics(Activity activity) {
DisplayMetrics displayMetrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayM
public static float getScreenWidth(Context context) {
WindowManager wm = (WindowManager)context.getSystemService("window");
Point point = new Point();
wm.getDefaultDisplay().getSize(point);
return (float)point.x;
public static float getScreenHeight(Context context) {
WindowManager wm = (WindowManager)context.getSystemService("window");
Point point = new Point();
wm.getDefaultDisplay().getSize(point);
return (float)point.y;
iOS开发技巧之:30分钟搞定iOS自定义相机
最近公司的项目中用到了相机,由于不用系统的相机,UI给的相机切图,必须自定义才可以。就花时间简单研究了一下相机的自定义。
  相机属于系统硬件,这就需要我们来手动调用iPhone的相机硬件,分为以下...
iOS - 自定义相机取景框
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delega...
iOS简单自定义相机
最近在做一个趣味相机的小项目,分享一下自己在学习的过程中的收获。
原文链接:http://www.jianshu.com/p/c64bf543f16a
这是一款使用 AVFoundation 自定义的相机,与系统原生相机有一样的外观但比系统的相机更好、更符合实际的...
打开本地相册或打开本地相机拍照,获取图片裁剪图片,上传图片加入头文件#import
#import 全部变量NSString*THE_IMG_PATH;
NSString *_im...
可以通过获取AVCaptureConnection,然后调用setVideoOrientation:方法解决图像90°问题。
比如:显示AVCaptureVideoPreviewLayer
实现原理:
黑色阴影是通过上,左,下,右四块阴影拼接起来的;
截图是通过:
首先我们已经知道裁剪框在所得图片上面的frame;
1.对原始图片压缩;
2.压缩后的...
这几天比较闲就抄了个自定义拍照的demo 然后在设置 self.previewLayer的拍照区域的时候,就算我设置了从0开始,他的拍照区域还是在中间的一部分,不会改变,但是高度和起点y值是可以改变的...
没有更多推荐了,

我要回帖

更多关于 多张照片组合一个相框 的文章

 

随机推荐