位置: 编程技术 - 正文

drawpaint的类方法(drawand paint)

编辑:rootadmin
import android.content.Context;import android.graphics.Bitmap;import android.graphics.Bitmap.Config;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.Paint.Style;import android.util.Log;import android.view.View;class DrawCG extends View {private static final String tag = "DrawCG";private Paint paint;private Canvas canv;private Bitmap mBitmap;// private EditText r1;// private EditText g1;// private EditText b1;public DrawCG(Context context, int width, int height) {super(context);// 声明画笔paint = new Paint();// 设置颜色paint.setColor(Color.RED);// 设置抗锯齿paint.setAntiAlias(true);// 设置线宽paint.setStrokeWidth(3);// 设置非填充paint.setStyle(Style.STROKE);// 声明位图mBitmap = Bitmap.createBitmap(width, height, Config.ARGB_);// 声明画布canv = new Canvas(mBitmap);}@Overrideprotected void onDraw(Canvas canvas) {canvas.drawBitmap(mBitmap, 0, 0, null);// super.onDraw(canvas);}/*** RED* * @return*/public Bitmap drawRed() {// canv.drawLine(, , , , paint);// canv.drawARGB(,3, 3, 3);canv.drawColor(Color.RED);return mBitmap;}/*** blue* * @return*/public Bitmap drawBlue() {canv.drawColor(Color.BLUE);return mBitmap;}/*** green* * @return*/public Bitmap drawGreen() {// canv.drawRect(new Rect(, , , ), paint);canv.drawColor(Color.GREEN);return mBitmap;}/** black*/public Bitmap drawBlack() {// canv.drawRect(new Rect(, , , ), paint);canv.drawColor(Color.BLACK);return mBitmap;}/** white **/public Bitmap drawWhite() {// canv.drawRect(new Rect(, , , ), paint);canv.drawColor(Color.WHITE);return mBitmap;}/** 灰阶 **/public Bitmap paintBitmap(int r, int g, int b) {Log.e(tag, "调用画图的方法,这里传入参数, r-->" &#; r &#; "| g--->" &#; g &#; "|b--->" &#; b);canv.drawRGB(r, g, b);return mBitmap;}/** 灰阶 **/public Bitmap Onehuijie(int r, int g, int b) {Log.e(tag, " 4*灰阶调用");// canv.drawARGB(, 4 * r - 1, 4 * g - 1, 4 * b - 1);if ((r == ) | (g == ) |( b == )) {canv.drawRGB(, , );Log.e(tag, "r ,g ,b 的&#;都是 , , ");}else {canv.drawRGB(4 * r , 4 * g , 4 * b);Log.e(tag, "灰阶计算执行,(4*r):"&#;(4*r)&#;"(4*g):"&#;(4*g)&#;"(4*b):"&#;(4*b));}return mBitmap;}/** 外围白,中心黑**/public Bitmap BB(float left, float top, float right, float bottom) {Log.e(tag, "外围白,中心黑class");canv.drawColor(Color.WHITE);Paint paint = new Paint();paint.setColor(Color.BLACK); // 设置画笔颜色paint.setStyle(Style.FILL);// 设置填充样式paint.setStrokeWidth();// 设置画笔宽度// canv.drawRect(, , , , paint);// canv.drawRect(left / 8, top / 4, right * 7 / 8, bottom * 3 / 4,// paint);// 直接构造canv.drawRect(left / 4, top / 4, right * 3 / 4, bottom * 3 / 4, paint);// 直接构造return mBitmap;}public Bitmap Bh(float left, float top, float right, float bottom) {Log.e(tag, "外围白,中心huiclass");canv.drawColor(Color.WHITE);Paint paint = new Paint();paint.setColor(Color.rgb(, , )); // 设置画笔颜色paint.setStyle(Style.FILL);// 设置填充样式paint.setStrokeWidth();// 设置画笔宽度canv.drawRect(left / 4, top / 4, right * 3 / 4, bottom * 3 / 4, paint);// 直接构造return mBitmap;}public Bitmap BJ(float left, float top, float right, float bottom) {Log.e(tag, "外围灰色,中心白class");canv.drawColor(Color.rgb(, , ));Paint paint = new Paint();paint.setColor(Color.WHITE); // 设置画笔颜色paint.setStyle(Style.FILL);// 设置填充样式paint.setStrokeWidth();// 设置画笔宽度canv.drawRect(left / 4, top / 4, right * 3 / 4, bottom * 3 / 4, paint);// 直接构造return mBitmap;}public Bitmap BK(float left, float top, float right, float bottom) {Log.e(tag, "外围灰色,中心blackclass");canv.drawColor(Color.rgb(, , ));Paint paint = new Paint();paint.setColor(Color.BLACK); // 设置画笔颜色paint.setStyle(Style.FILL);// 设置填充样式paint.setStrokeWidth();// 设置画笔宽度canv.drawRect(left / 4, top / 4, right * 3 / 4, bottom * 3 / 4, paint);// 直接构造return mBitmap;}}

推荐整理分享drawpaint的类方法(drawand paint),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:drawand paint,draw paintings,draw方法的实现,drawand paint,draw paint,drawpie方法绘制的图形是,draw paint,draw paint,内容如对您有帮助,希望把文章链接给更多的朋友!

drawpaint的类方法(drawand paint)

版权声明:本文为博主原创文章,未经博主允许不得转载。

高级控件AdapterView(一):Adapte继承体系及BaseAdapter 一、适配器接口Adapter继承体系Adapt是一个接口,是联通多条目控件AdaptView(ViewGroup是其父类,ListView、GridView、SpinnerView是其子类)与数据集的桥梁,主

android 开源项目GuillotineMenu,酷炫的铡刀菜单 开源项目GuillotineMenu使用指南先上效果图:IDE使用的是Androidstudio.首先下载GuillotineMenu项目的library引用到项目中,下载地址:

Android:Layout_weight 随录 Layout_weight属性的作用:它是用来分配属于空间的一个属性,你可以设置他的权重。很多人不知道剩余空间是个什么概念,下面我先来说说剩余空间。看

标签: drawand paint

本文链接地址:https://www.jiuchutong.com/biancheng/370930.html 转载请保留说明!

上一篇:Android Studio 错误: 非法字符: 'ufeff' 解决方案|错误: 需要class, interface或enum(android studiojava报错)

下一篇:高级控件AdapterView(一):Adapte继承体系及BaseAdapter(高级控件动态数据加载过程有哪些)

  • 税收筹划的内容主要包括
  • 应纳税所得额的会计分录
  • 营业成本和生产成本的公式
  • 支付利息现金流量表中什么增加
  • 远期交易怎么结算
  • 建筑业收到预收款预缴增值税
  • 零申报还要抄税吗
  • 科目余额表解析
  • 分公司可以用总公司的业绩吗
  • 设备5年直线法计提折旧怎么做
  • 资产负债表里的存货包括哪些科目
  • 辞退职工赔偿金如何计算
  • 收票据计息利息为什么要红字冲账?
  • 预付账款转入其他非流动资产
  • 企业预收款项业务不多的情况下可以不设置预收账款科目
  • 应入固定资产的已做费用,如何调账
  • 增值税普票跨月怎么冲红
  • 外国专家工资个税
  • 税种申报表样表
  • 农民专业合作社属于什么企业类型
  • 年终奖需要计入工资交社保吗
  • 应收及预付款项包括( )
  • 出纳人员怎么核对现金日记账?
  • 生产成本期末余额在贷方
  • 应收票据借贷方核算什么内容
  • 收入3000以下占比
  • 无偿调入固定资产账务处理
  • php新手入门教程
  • PHP:imagecreatefromgd2()的用法_GD库图像处理函数
  • mac m1 rosetta编译
  • 会计核算方法体系构成
  • 车辆维修费怎么做分录
  • php和apache
  • 运输中合理损耗计入存货成本吗
  • php注释有几种?如何表示?
  • 小微企业会计制度是什么
  • 未分配利润是负数是亏损吗
  • 退回的个税手续费计入什么科目
  • sql随机函数rand怎么用
  • 处置子公司利润表
  • 什么情况个税可以扣除
  • sql2008r2怎么用
  • 一般纳税人提供财政部和国家税务总局规定的
  • 工程结转成本分录
  • 应交增值税负数表示什么
  • 纺织品业务
  • 收到货款未开票怎么入账
  • 转让技术所有权是其他业务收入吗
  • 专票已认证还能作废吗
  • 结转利润分配的二级明细账户
  • 抵账房买卖流程
  • 公司账户收入多少要扣税
  • 股权支付费用是什么意思
  • 厂家返利怎么入账
  • 退回多交的所得税怎么退
  • 增值税其他免税销售额
  • 应交税费应交增值税已交税金怎么用
  • 专栏设计模板
  • sql不重复计数函数
  • mysql忽略大小写设置
  • win10如何连接远程电脑
  • 彻底关闭windows10自动更新工具
  • centos5.10安装
  • centos 安装方法
  • mmtray2k.exe有什么作用 是什么进程 mmtray2k进程查询
  • win8系统文件
  • easyui搜索框
  • python检索文件中的内容
  • 同一个页面
  • 让图片跳跃起来怎么弄
  • unity地形图片
  • 堆实现栈
  • js中的面向对象
  • 税务机关落实六保六稳
  • 河北省国家税务局电子税务局
  • 更改税务购票员
  • 上海个人所得税税率表2023
  • 江西税务局官网登录
  • 山东统一发票查询平台
  • 一般纳税人资格查询
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设