Camera 增加1:1拍照

本文介绍了Camera应用中图片尺寸及比例配置的具体实现方式,包括不同比例下的支持尺寸列表、配置项及其映射关系等内容。新增了1:1比例的支持,并对其可用尺寸进行了详细说明。
---- vendor/mediatek/proprietary/packages/apps/Camera/res/values/arrays.xml ----
index 80c4b3a..ab8528f 100755
@@ -406,6 +406,9 @@
         <item>@string/pref_camera_picturesize_entry_1280x960</item>
         <item>@string/pref_camera_picturesize_entry_2048x1536</item>
         <item>@string/pref_camera_picturesize_entry_2592x1936</item>
+        <!-- 1:1 -->
+        <item>@string/pref_camera_picturesize_entry_1280x768</item>
+        <item>@string/pref_camera_picturesize_entry_3328x1872</item>
     </string-array>
 
     <!-- When launching the camera app first time, we will set the picture
@@ -461,6 +464,9 @@
         <item>1440x960</item>
         <item>2048x1360</item>
         <item>2560x1712</item>
+        <!-- 1:1 -->
+        <item>960x960</item>
+        <item>2448x2448</item>
     </string-array>
 
     <string-array name="pref_camera_picturesize_ratio_entries" translatable="false">
@@ -468,12 +474,14 @@
         <item>@string/pref_camera_picturesize_ratio_entry_5_3</item>
         <item>@string/pref_camera_picturesize_ratio_entry_3_2</item>
         <item>@string/pref_camera_picturesize_ratio_entry_4_3</item>
+        <item>@string/pref_camera_picturesize_ratio_entry_1_1</item>
     </string-array>
     <string-array name="pref_camera_picturesize_ratio_entryvalues" translatable="false">
         <item>1.7778</item>
         <item>1.6667</item>
         <item>1.5</item>
         <item>1.3333</item>
+        <item>1</item>
     </string-array>
 
     <!-- Default focus mode setting.-->


--- vendor/mediatek/proprietary/packages/apps/Camera/res/values/strings.xml ---
index 59bdb96..0869eba 100755
@@ -201,6 +201,7 @@
     <string name="pref_camera_picturesize_ratio_entry_5_3" translatable="false">@string/pref_camera_picturesize_ratio_entry_16_9</string>
     <string name="pref_camera_picturesize_ratio_entry_3_2" translatable="false">@string/pref_camera_picturesize_ratio_entry_16_9</string>
     <string name="pref_camera_picturesize_ratio_entry_4_3">Standard (4:3)</string>
+    <string name="pref_camera_picturesize_ratio_entry_1_1">Square (1:1)</string>
     <!-- ISO -->
     <string name="pref_camera_iso_title" translatable="false">ISO</string>
     <string name="pref_camera_iso_default" translatable="false">auto</string>


 vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/setting/SettingDataBase.java 
index 7d5336f..e2bec4e 100755
@@ -386,6 +386,7 @@ public class SettingDataBase {
     private static final String PICTURE_RATIO_5_3 = "1.6667";
     private static final String PICTURE_RATIO_3_2 = "1.5";
     private static final String PICTURE_RATIO_4_3 = "1.3333";
+    private static final String PICTURE_RATIO_1_1 = "1";
     
     private static final String[] PICTURE_SIZE_4_3 = new String[] {
         "320x240",
@@ -437,6 +438,10 @@ public class SettingDataBase {
         "2048x1360",
         "2560x1712"
     };
+    private static final String[] PICTURE_SIZE_1_1 = new String[] {
+        "2448x2448",
+        "960x960",
+ };
     
     public static final String[] VIDEO_QUALITY_WHITHOUT_FINE = new String[] {
         Integer.toString(CamcorderProfileEx.QUALITY_HIGH) ,
@@ -605,6 +610,15 @@ public class SettingDataBase {
                     .setEnable(true)
                     .setMappingFinder(new PictureSizeMappingFinder())
                     .setValues(PICTURE_SIZE_3_2)),
+        
+ new Restriction(SettingConstants.ROW_SETTING_PICTURE_RATIO)
+            .setType(Restriction.TYPE_SETTING)
+            .setValues(PICTURE_RATIO_1_1)
+            .setRestrictions(
+                new Restriction(SettingConstants.ROW_SETTING_PICTURE_SIZE)
+                    .setEnable(true)
+                    .setMappingFinder(new PictureSizeMappingFinder())
+                    .setValues(PICTURE_SIZE_1_1)),
                     
         new Restriction(SettingConstants.ROW_SETTING_SMILE_SHOT)
             .setValues("on")


 vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/setting/SettingUtils.java 
index 0fbb09f..d3329d1 100755
@@ -310,6 +310,7 @@ public class SettingUtils {
         if (context != null && parameters != null) {
             // Add standard preview ratio.
             supportedRatios.add(getRatioString(4d / 3));
+            supportedRatios.add(getRatioString(1d / 1));
 
             mCurrentFullScreenRatio = findFullscreenRatio(context);
             List<String> fullScreenPictureSizes = buildSupportedPictureSizeByRatio(parameters,


 vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/v2/util/Utils.java 
index dfe4537..8f51724 100755
@@ -100,7 +100,7 @@ public class Utils {
     public static final String               RESET_STATE_VALUE_DISABLE = "disable-value";
     /** Orientation hysteresis amount used in rounding, in degrees. */
     public static final int                  ORIENTATION_HYSTERESIS = 5;
-    public static final double[]             RATIOS = new double[] { 1.3333, 1.5, 1.6667, 1.7778 };
+    public static final double[]             RATIOS = new double[] { 1, 1.3333, 1.5, 1.6667, 1.7778 };
     public static final double               ASPECT_TOLERANCE = 0.02;
     private static ImageFileNamer            sImageFileNamer;
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值