登录
首页 » Android » Android PathEffect 效果实例

Android PathEffect 效果实例

于 2022-07-25 发布 文件大小:14.33 kB
0 149
下载积分: 2 下载次数: 1

代码说明:

从一本书中得到的Android PathEffect 效果实例,不多说了,直接把关键代码帖出来吧,需要完整代码的可下载本源码,运行的效果请参见下边的截图所示,运行时,可看到多条像流水一样的路径曲线,下面是代码:   // 定义画板为白色   canvas.drawColor(Color.WHITE);   pe[0] = null;   // 此PathEffect为圆滑的弧形   pe[1] = new CornerPathEffect(10);   // 离散的线   // 第一个参数为离散在弧上的间距   // 第二个参数为离散的程度   pe[2] = new DiscretePathEffect(3, 10);   // Dash为破折号的意思。 应该是破这行   // 其中第一个参数是new float[]{} 表示其中的间隔和距离   // phase表示相位   pe[3] = new DashPathEffect(new float[] { 20, 5, 5, 20 }, phase);   //先建立一个Path 然后创建PathDashPathEffect对象 其中p为path   Path p = new Path();   p.addRect(0,0,8,8,Path.Direction.CW);   pe[4] = new PathDashPathEffect(p, 12, phase, PathDashPathEffect.Style.ROTATE);   //此方法表示两个组合的PathEffect   pe[5] = new ComposePathEffect(pe[2], pe[4]);   //结果和pe[5]类似   pe[6] = new SumPathEffect(pe[4], pe[3]);   // 开始画七条线   for (int i = 0; i < pe.length; i++) {   // 如果没有paint.setPathEffect(),那么系统默认为paint.setPathEffect(null);   paint.setPathEffect(pe[i]);   paint.setColor(colors[i]);   canvas.drawPath(path, paint);   //使画板平移

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • ProviderInfo
    Holds information about a specific android.content.ContentProvider content provider.
    2014-05-17 23:56:15下载
    积分:1
  • 《HTML5与CSS3权威指南》范例及代码 下载
    《HTML5与CSS3权威指南》范例及代码,共22章
    2015-01-06下载
    积分:1
  • android解压缩
    android中,可以将文字及其他一些方面的进行压缩,里面也包含解压缩
    2022-02-14 06:46:49下载
    积分:1
  • Android 家庭理财通APP完整源码
    Android 家庭理财通APP完整源码,这个理财软件完成的功能有:新增支出添加管理、新增收入添加管理、我的支出管理、我的收入管理、数据管理、系统设置、收支便签管理。界面挺漂亮的,需要哪一项功能,轻触即可打开。测试时无需输入密码,即可进入APP主界面。
    2022-08-08 20:16:34下载
    积分:1
  • 百度地图小程序
    一款使用百度地图api的安卓小地图,程序可以正常安装使用,并能够实现简单的查看周边地图的功能
    2023-04-29 23:20:03下载
    积分:1
  • 远程视频监控
    【核心代码】 public interface CameraSource {  static final String LOG_TAG = "camera";  /**  * Open the camera source for subsequent use via calls to capture().  *   * @return true if the camera source was successfully opened.  */  boolean open();  /**  * Close the camera source. Calling close on a closed CameraSource is  * permitted but has no effect. The camera source may be reopened after  * being closed.  */  void close();  /**  * The width of the captured image.  *   * @return the width of the capture in pixels  */  int getWidth();  /**  * The height of the captured image.  *   * @return the height of the capture in pixels  */  int getHeight();  /**  * Attempts to render the current camera view onto the supplied canvas.  * The capture will be rendered into the rectangle (0,0,width,height).  * Outstanding transformations on the canvas may alter this.  *   * @param canvas the canvas to which the captured pixel data will be written  * @return true iff a frame was successfully written to the canvas  */  boolean capture(Canvas canvas);  boolean saveImage(String savePath, String fileName); }
    2013-12-04下载
    积分:1
  • wifi_control_computer
    一个基于安卓平台的用wifi控制电脑的源代码(An Android-based platform for the control of a computer source code wifi)
    2013-09-07 20:08:04下载
    积分:1
  • AvdStartDialog
    Avd Start Dialog Source Code for Andriod.
    2013-10-24 10:34:54下载
    积分:1
  • 基于股票的一个Android应用(内含源码)
    基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) ,基于股票的一个Android应用(内含源码) 
    2022-02-04 23:20:24下载
    积分:1
  • android Gallery控件学习示例源码
    android Gallery控件学习示例源码
    2014-05-29下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载