From 3f9660f2dc2d3dfa0cff8f71e023e73a11306247 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: Thu, 9 Aug 2018 23:56:12 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9426a6f2..2e0481c2 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ * [安卓自定义View进阶 - 特殊形状控件事件处理方案](https://github.com/GcsSloop/AndroidNote/blob/master/CustomView/Advance/%5B17%5Dtouch-matrix-region.md) * [安卓自定义View进阶 - 多点触控详解](https://github.com/GcsSloop/AndroidNote/blob/master/CustomView/Advance/%5B18%5Dmulti-touch.md) * [安卓自定义View进阶 - 手势检测(GestureDetector)](https://github.com/GcsSloop/AndroidNote/blob/master/CustomView/Advance/%5B19%5Dgesture-detector.md) + * [安卓自定义View进阶 - 缩放手势检测(ScaleGestureDetector)](http://www.gcssloop.com/customview/scalegesturedetector) * [ViewSupport - 自定义View工具包](https://github.com/GcsSloop/ViewSupport) From b8f11e46be13169021ef5b1e0eda6a94ac0c6d8b Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2018年8月12日 18:48:15 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2e0481c2..13ce9203 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ * [雕虫晓技(五) 网格分页布局源码解析(上) (付费)](https://xiaozhuanlan.com/topic/5841730926) * [雕虫晓技(六) 网格分页布局源码解析(下) (付费)](https://xiaozhuanlan.com/topic/1456397082) * [雕虫晓技(七) 用旧Android手机做远程摄像头](http://www.gcssloop.com/gebug/internet-ip-webcam) +* [雕虫晓技(八) Android与数据流的斗争](http://www.gcssloop.com/gebug/android-stream) ****** From dcadfe6a877cca993730a3c257720a912c9a7341 Mon Sep 17 00:00:00 2001 From: sloop Date: Mon, 3 Sep 2018 12:17:42 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 13ce9203..4763beca 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ * [雕虫晓技(六) 网格分页布局源码解析(下) (付费)](https://xiaozhuanlan.com/topic/1456397082) * [雕虫晓技(七) 用旧Android手机做远程摄像头](http://www.gcssloop.com/gebug/internet-ip-webcam) * [雕虫晓技(八) Android与数据流的斗争](http://www.gcssloop.com/gebug/android-stream) +* [雕虫晓技(九) Netty与私有协议框架](http://www.gcssloop.com/gebug/netty-private-protocol) ****** From e7719edb6172f54430cc54fd0c32b7ed047043d4 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: Sun, 9 Sep 2018 18:43:01 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4763beca..9e46e27d 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ * [雕虫晓技(七) 用旧Android手机做远程摄像头](http://www.gcssloop.com/gebug/internet-ip-webcam) * [雕虫晓技(八) Android与数据流的斗争](http://www.gcssloop.com/gebug/android-stream) * [雕虫晓技(九) Netty与私有协议框架](http://www.gcssloop.com/gebug/netty-private-protocol) +* [雕虫晓技(十) Android超简单气泡效果](http://www.gcssloop.com/gebug/bubble-sample) ****** @@ -109,6 +110,7 @@ ## 开源库 +* [arc-seekbar - 弧形SeekBar](https://github.com/GcsSloop/arc-seekbar) * [encrypt - 加密工具包](https://github.com/GcsSloop/encrypt) * [rclayout - 通用圆角布局](https://github.com/GcsSloop/rclayout) * [FontsManager - 快速替换字体](https://github.com/GcsSloop/FontsManager) From e286b0ea1ade6d366dd5770fead509d28b9e5c57 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2018年9月15日 11:17:50 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomView/Advance/[01]CustomViewProcess.md | 2 +- CustomView/Base/[03]Color.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CustomView/Advance/[01]CustomViewProcess.md b/CustomView/Advance/[01]CustomViewProcess.md index 5166f06f..70e4a5be 100644 --- a/CustomView/Advance/[01]CustomViewProcess.md +++ b/CustomView/Advance/[01]CustomViewProcess.md @@ -29,7 +29,7 @@ > 例如:制作一个支持自动加载网络图片的ImageView,制作图表等。 -**PS: 自定义View在大多数情况下都有替代方案,利用图片或者组合动画来实现,但是使用后者可能会面临内存耗费过大,制作麻烦更诸多问题。** +**PS: 自定义View在大多数情况下都有替代方案,利用图片或者组合动画来实现,但是使用后者可能会面临内存耗费过大,制作麻烦等诸多问题。** ******* diff --git a/CustomView/Base/[03]Color.md b/CustomView/Base/[03]Color.md index 86d3983c..300b9cc5 100644 --- a/CustomView/Base/[03]Color.md +++ b/CustomView/Base/[03]Color.md @@ -32,7 +32,7 @@ B(Blue) | 蓝色 | 无色 | 蓝色 *其中 A R G B 的取值范围均为0~255(即16进制的0x00~0xff)* -A 从ox00到oxff表示从透明到不透明。 +A 从0x00到0xff表示从透明到不透明。 RGB 从0x00到0xff表示颜色从浅到深。 @@ -131,7 +131,7 @@ PicPick具备了截取全屏、活动窗口、指定区域、固定区域、手 **注意:** -1.这里我们一般把每个通道的取值从0(ox00)到255(0xff)映射到0到1的浮点数表示。 +1.这里我们一般把每个通道的取值从0(0x00)到255(0xff)映射到0到1的浮点数表示。 2.这里等式右边的"绘制的颜色"、"Canvas上的原有颜色"都是经过预乘了自己的Alpha通道的值。如绘制颜色:0x88ffffff,那么参与运算时的每个颜色通道的值不是1.0,而是(1.0 * 0.5333 = 0.5333)。 (其中0.5333 = 0x88/0xff) From 1d7b090581212d2b28c558933e74b829abb6722b Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2018年9月15日 18:01:24 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Advance/[02]Canvas_BasicGraphics.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CustomView/Advance/[02]Canvas_BasicGraphics.md b/CustomView/Advance/[02]Canvas_BasicGraphics.md index 65720057..60143dc4 100644 --- a/CustomView/Advance/[02]Canvas_BasicGraphics.md +++ b/CustomView/Advance/[02]Canvas_BasicGraphics.md @@ -111,22 +111,22 @@ Canvas我们可以称之为画布,能够在上面绘制各种东西,是安 ****** ### 绘制矩形: -确定一个矩形最少需要四个数据,就是**对角线的两个点**的坐标值,这里一般采用**左上角和右下角**的两个点的坐标。 +我们都知道,确定一个矩形最少需要四个数据,就是**对角线的两个点**的坐标值,这里一般采用**左上角和右下角**的两个点的坐标。 关于绘制矩形,Canvas提供了三种重载方法,第一种就是提供**四个数值(矩形左上角和右下角两个点的坐标)来确定一个矩形**进行绘制。 其余两种是先将矩形封装为**Rect或RectF**(实际上仍然是用两个坐标点来确定的矩形),然后传递给Canvas绘制,如下: ``` java - // 第一种 - canvas.drawRect(100,100,800,400,mPaint); +// 第一种 +canvas.drawRect(100,100,800,400,mPaint); - // 第二种 - Rect rect = new Rect(100,100,800,400); - canvas.drawRect(rect,mPaint); +// 第二种 +Rect rect = new Rect(100,100,800,400); +canvas.drawRect(rect,mPaint); - // 第三种 - RectF rectF = new RectF(100,100,800,400); - canvas.drawRect(rectF,mPaint); +// 第三种 +RectF rectF = new RectF(100,100,800,400); +canvas.drawRect(rectF,mPaint); ``` 以上三种方法所绘制出来的结果是完全一样的。 @@ -192,7 +192,7 @@ Canvas我们可以称之为画布,能够在上面绘制各种东西,是安 ****** ### 绘制椭圆: -相对于绘制圆角矩形,绘制椭圆就简单的多了,因为他只需要一个矩形矩形作为参数: +相对于绘制圆角矩形,绘制椭圆就简单的多了,因为他只需要一个矩形作为参数: ``` java // 第一种 From 40c865975c5fc27987251d44bbd97a6dcdc91c89 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2018年9月17日 22:39:34 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomView/Advance/[03]Canvas_Convert.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/CustomView/Advance/[03]Canvas_Convert.md b/CustomView/Advance/[03]Canvas_Convert.md index 2e1c8206..4ad9f63f 100644 --- a/CustomView/Advance/[03]Canvas_Convert.md +++ b/CustomView/Advance/[03]Canvas_Convert.md @@ -77,15 +77,15 @@ 缩放比例(sx,sy)取值范围详解: -| 取值范围(n) | 说明 | -| -------- | -------------------------- | -| [-∞, -1) | 先根据缩放中心放大n倍,再根据中心轴进行翻转 | -| -1 | 根据缩放中心轴进行翻转 | -| (-1, 0) | 先根据缩放中心缩小到n,再根据中心轴进行翻转 | -| 0 | 不会显示,若sx为0,则宽度为0,不会显示,sy同理 | -| (0, 1) | 根据缩放中心缩小到n | -| 1 | 没有变化 | -| (1, +∞) | 根据缩放中心放大n倍 | +| 取值范围(n) | 说明 | +| ----------- | ---------------------------------------------- | +| (-∞, -1) | 先根据缩放中心放大n倍,再根据中心轴进行翻转 | +| -1 | 根据缩放中心轴进行翻转 | +| (-1, 0) | 先根据缩放中心缩小到n,再根据中心轴进行翻转 | +| 0 | 不会显示,若sx为0,则宽度为0,不会显示,sy同理 | +| (0, 1) | 根据缩放中心缩小到n | +| 1 | 没有变化 | +| (1, +∞) | 根据缩放中心放大n倍 | 如果在缩放时稍微注意一下就会发现缩放的中心默认为坐标原点,而缩放中心轴就是坐标轴,如下: @@ -181,6 +181,9 @@ 调用两次缩放则 x轴实际缩放为0.5x0.5=0.25 y轴实际缩放为0.5x0.1=0.05 下面我们利用这一特性制作一个有趣的图形。 + +> 注意设置画笔模式为描边(STROKE) + ``` java // 将坐标系原点移动到画布正中心 canvas.translate(mWidth / 2, mHeight / 2); @@ -324,7 +327,7 @@ Y = sy * x + y #### (5)快照(save)和回滚(restore) -Q: 为什存在快照与回滚
+Q: 为什么存在快照与回滚
A:画布的操作是不可逆的,而且很多画布操作会影响后续的步骤,例如第一个例子,两个圆形都是在坐标原点绘制的,而因为坐标系的移动绘制出来的实际位置不同。所以会对画布的一些状态进行保存和回滚。
From 54c54a385b983cedac66a3cdf8d99248960c3d0b Mon Sep 17 00:00:00 2001 From: GcsSloop Date: Fri, 5 Oct 2018 14:41:09 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomView/Advance/[05]Path_Basic.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CustomView/Advance/[05]Path_Basic.md b/CustomView/Advance/[05]Path_Basic.md index 41fb94e8..58e9c2d2 100644 --- a/CustomView/Advance/[05]Path_Basic.md +++ b/CustomView/Advance/[05]Path_Basic.md @@ -36,7 +36,7 @@ **请关闭硬件加速,以免引起不必要的问题!
请关闭硬件加速,以免引起不必要的问题!
请关闭硬件加速,以免引起不必要的问题!** -**在AndroidMenifest文件中application节点下添上 android:hardwareAccelerated="false"以关闭整个应用的硬件加速。
更多请参考这里:[Android的硬件加速及可能导致的问题](https://github.com/GcsSloop/AndroidNote/issues/7)** +**在AndroidMainfest文件中application节点下添上 android:hardwareAccelerated="false"以关闭整个应用的硬件加速。
更多请参考这里:[Android的硬件加速及可能导致的问题](https://github.com/GcsSloop/AndroidNote/issues/7)** ## Path作用 本次特地开了一篇详细讲解Path,为什么要单独摘出来呢,这是因为Path在2D绘图中是一个很重要的东西。 @@ -60,10 +60,10 @@ _The Path class encapsulates compound (multiple contour) geometric paths consist 另外路径有开放和封闭的区别。 -| 图像 | 名称 | 备注 | -| ---------------------------------------- | ---- | ------------- | +| 图像 | 名称 | 备注 | +| ------------------------------------------------------------ | -------- | -------------------------- | | ![](http://ww4.sinaimg.cn/thumbnail/005Xtdi2jw1f0zx9g9gggj30f00aiwek.jpg) | 封闭路径 | 首尾相接形成了一个封闭区域 | -| ![](http://ww1.sinaimg.cn/thumbnail/005Xtdi2jw1f0zxg8ilpxj30f00aimx8.jpg) | 开放路径 | 没有首位相接形成封闭区域 | +| ![](http://ww1.sinaimg.cn/thumbnail/005Xtdi2jw1f0zxg8ilpxj30f00aimx8.jpg) | 开放路径 | 没有首尾相接形成封闭区域 | > 这个是我随便画的,仅为展示一下区别,请无视我灵魂画师一般的绘图水准。 From 74d5634da2754aecdcf139975eba8201d6557f64 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: Fri, 5 Oct 2018 14:46:42 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomView/Advance/[09]Matrix_Basic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CustomView/Advance/[09]Matrix_Basic.md b/CustomView/Advance/[09]Matrix_Basic.md index a78731e1..e3985de3 100644 --- a/CustomView/Advance/[09]Matrix_Basic.md +++ b/CustomView/Advance/[09]Matrix_Basic.md @@ -168,7 +168,7 @@ Matrix 是一个矩阵,最根本的作用就是坐标转换,下面我们就 ### 后乘(post) -前乘相当于矩阵的左乘: +后乘相当于矩阵的左乘: ![](https://ww3.sinaimg.cn/large/006tKfTcgy1fhe1vta7ooj302s00pq2u.jpg) From 96f6da122c5c254db9bb8843fb897f9025f35582 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2018年11月14日 10:13:45 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9e46e27d..1e8b8821 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ * [安卓自定义View进阶 - 多点触控详解](https://github.com/GcsSloop/AndroidNote/blob/master/CustomView/Advance/%5B18%5Dmulti-touch.md) * [安卓自定义View进阶 - 手势检测(GestureDetector)](https://github.com/GcsSloop/AndroidNote/blob/master/CustomView/Advance/%5B19%5Dgesture-detector.md) * [安卓自定义View进阶 - 缩放手势检测(ScaleGestureDetector)](http://www.gcssloop.com/customview/scalegesturedetector) + * [安卓自定义View进阶 - 画笔基础(Paint)](http://www.gcssloop.com/customview/paint-base) * [ViewSupport - 自定义View工具包](https://github.com/GcsSloop/ViewSupport) From 438ffe163abdf9fb64b87467dd6a60864643181b Mon Sep 17 00:00:00 2001 From: ytianhui Date: 2019年3月19日 12:04:12 +0800 Subject: [PATCH 11/12] Update [11]Matrix_3D_Camera.md misspell --- CustomView/Advance/[11]Matrix_3D_Camera.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CustomView/Advance/[11]Matrix_3D_Camera.md b/CustomView/Advance/[11]Matrix_3D_Camera.md index 0e4c83b6..1c309dae 100644 --- a/CustomView/Advance/[11]Matrix_3D_Camera.md +++ b/CustomView/Advance/[11]Matrix_3D_Camera.md @@ -16,7 +16,7 @@ | 基本方法 | save、restore | 保存、 回滚 | | 常用方法 | getMatrix、applyToCanvas | 获取Matrix、应用到画布 | | 平移 | translate | 位移 | -| 旋转 | rotat (API 12)、rotateX、rotateY、rotateZ | 各种旋转 | +| 旋转 | rotate (API 12)、rotateX、rotateY、rotateZ | 各种旋转 | | 相机位置 | setLocation (API 12)、getLocationX (API 16)、getLocationY (API 16)、getLocationZ (API 16) | 设置与获取相机位置 | > Camera的方法并不是特别多,很多内容与之前的讲解的Canvas和Matrix类似,不过又稍有不同,之前的画布操作和Matrix主要是作用于2D空间,而Camera则主要作用于3D空间。 From 40cd93974e33cfb1cfbdecc994ad1baac882ad34 Mon Sep 17 00:00:00 2001 From: GcsSloop Date: 2019年4月29日 17:08:41 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomView/Advance/[11]Matrix_3D_Camera.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CustomView/Advance/[11]Matrix_3D_Camera.md b/CustomView/Advance/[11]Matrix_3D_Camera.md index 0e4c83b6..ce0b0d7a 100644 --- a/CustomView/Advance/[11]Matrix_3D_Camera.md +++ b/CustomView/Advance/[11]Matrix_3D_Camera.md @@ -71,7 +71,9 @@ ![](http://ww4.sinaimg.cn/large/005Xtdi2jw1f7q71yek4wg308c058go5.gif) -> 摄像机的位置默认是 (0, 0, -576)。其中 -576= -8 x 72,虽然官方文档说距离屏幕的距离是 -8, 但经过测试实际距离是 -576 像素,当距离为 -10 的时候,实际距离为 -720 像素。不过这个数值72我也不明白是什么东西,我使用了3款手机测试,屏幕大小和像素密度均不同,但结果都是一样的,知道的小伙伴可以告诉我一声。 +> 摄像机的位置默认是 (0, 0, -576)。其中 -576= -8 x 72,虽然官方文档说距离屏幕的距离是 -8, 但经过测试实际距离是 -576 像素,当距离为 -10 的时候,实际距离为 -720 像素。我使用了3款手机测试,屏幕大小和像素密度均不同,但结果都是一样的。 +> +> 这个魔数可以在 Android 底层的图像引擎 Skia 中找到。在 Skia 中,Camera 的位置单位是英寸,英寸和像素的换算单位在 Skia 中被固定为 72 像素,而 Android 中把这个换算单位照搬了过来。

AltStyle によって変換されたページ (->オリジナル) /