- 浏览: 46695 次
- 性别:
- 来自: 深圳
最新评论
Api Demo - .graphics(6)
- 博客分类:
- Api Demo - .graphics
//关键字:截取画布 package com.example.android.apis.graphics; import android.app.Activity; import android.content.Context; import android.graphics.*; import android.os.Bundle; import android.view.View; public class Clipping extends GraphicsActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SampleView(this)); } private static class SampleView extends View { private Paint mPaint; private Path mPath; public SampleView(Context context) { super(context); setFocusable(true); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setStrokeWidth(6); mPaint.setTextSize(16); mPaint.setTextAlign(Paint.Align.RIGHT); mPath = new Path(); } private void drawScene(Canvas canvas) { canvas.clipRect(0, 0, 100, 100);//截取指定矩形为绘制区域 canvas.drawColor(Color.WHITE); mPaint.setColor(Color.RED); canvas.drawLine(0, 0, 100, 100, mPaint); mPaint.setColor(Color.GREEN); canvas.drawCircle(30, 70, 30, mPaint); mPaint.setColor(Color.BLUE); canvas.drawText("Clipping", 100, 30, mPaint); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.GRAY); canvas.save();//保存当前画布状态,待操作完成后restore还原。 canvas.translate(10, 10); drawScene(canvas); canvas.restore(); canvas.save(); canvas.translate(160, 10); canvas.clipRect(10, 10, 90, 90); canvas.clipRect(30, 30, 70, 70, Region.Op.DIFFERENCE);//取不同(A有B木有) drawScene(canvas); canvas.restore(); canvas.save(); canvas.translate(10, 160); mPath.reset();//复位路径 // canvas.clipPath(mPath); // 清空 mPath.addCircle(50, 50, 50, Path.Direction.CCW);// canvas.clipPath(mPath, Region.Op.REPLACE);//替换覆盖(B覆盖A) drawScene(canvas); canvas.restore(); canvas.save(); canvas.translate(160, 160); canvas.clipRect(0, 0, 60, 60); canvas.clipRect(40, 40, 100, 100, Region.Op.UNION);//取公共(A有B也有) drawScene(canvas); canvas.restore(); canvas.save(); canvas.translate(10, 310); canvas.clipRect(0, 0, 60, 60); canvas.clipRect(40, 40, 100, 100, Region.Op.XOR);//(只有A有或只有B有) drawScene(canvas); canvas.restore(); canvas.save(); canvas.translate(160, 310); canvas.clipRect(0, 0, 60, 60); canvas.clipRect(40, 40, 100, 100, Region.Op.REVERSE_DIFFERENCE);//(B有A木有) drawScene(canvas); canvas.restore(); } } }
发表评论
-
图片处理
2012-11-28 02:48 0http://www.linuxidc.com/Linux/2 ... -
Api Demo - .graphics(24)>>Cube
2012-08-03 15:18 1135package com.example.android.api ... -
Api Demo - .graphics(24)>>TouchRotateActivity
2012-08-03 15:07 1026package com.example.android.api ... -
Api Demo - .graphics(23)>>CubeMapActivity
2012-07-31 16:31 1375package com.opengl.test; imp ... -
opengles 学习关键字
2012-07-24 09:35 626主动渲染、平面着色、透视投影、near、索引法、glLight ... -
Api Demo - .graphics(21)>>StaticTriangleRenderer
2012-07-23 17:51 1226package com.example.android.api ... -
Api Demo - .graphics(20)>>CompressedTextureActivity
2012-07-23 16:50 1360/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(19)
2012-07-20 22:45 711package com.example.android.api ... -
Api Demo - .graphics(18)
2012-07-20 10:32 811package com.example.android.api ... -
Api Demo - .graphics(17)
2012-07-19 11:43 925/* package com.example.andro ... -
Api Demo - .graphics(16)
2012-07-18 14:54 596package com.example.android.api ... -
Api Demo - .graphics(15)
2012-07-18 12:55 791package com.example.android.api ... -
Api Demo - .graphics(14)
2012-07-18 11:50 796package com.example.android.api ... -
Api Demo - .graphics(13)
2012-07-17 11:38 892//关键字 Paint,MaskFilte,Path,Xfer ... -
Api Demo - .graphics(12)
2012-07-17 10:44 636<?xml version="1.0" ... -
Api Demo - .graphics(11)
2012-07-17 09:53 775//关键字:Shader ,ShapeDrawable pa ... -
Api Demo - .graphics(10)
2012-07-16 17:59 1034/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(9)
2012-07-16 11:26 741//关键字:颜色合成,JPEG,PNG图片解压,Bitmap压 ... -
Api Demo - .graphics(8)
2012-07-16 10:43 645//关键字:ColorMatrixColorFilter; ... -
Api Demo - .graphics(7)
2012-07-16 09:53 720// 关键字:Porter-Duff package c ...
相关推荐
Microsoft.Maui.Graphics是完全使用C#针对iOS,Android,Windows,macOS,Tizen和Linux的跨平台图形库。 使用此库,您可以使用通用API来定位多个抽象,从而使您可以在平台之间共享绘图代码,或在单个应用程序内混合...
代码很短,但是找jar包找的欲仙欲死,包括commons-io-1.4.jar,commons-logging-1.1.1.jar,docx4j-3.3.3.jar,freemarker.jar,google-collections.jar,log4j-1.2.8....xalan-2.7.0.jar,xmlgraphics-commons-1.3.jar
ArcGIS API for iOS 使您可使用 Objective C 构建多种应用程序(这些应用程序将运用 ArcGIS Server 提供的强大制图、地理编码、地理处理和自定义功能)并将它们部署到 Apple iPhone、iPod Touch 和 iPad 设备。API ...
WebGL Audio API for 3D Graphics in Three.JS by Igor Fortel 6 pages pdf short paper with a small demo
很多的官方demo,api,超值的啊。 animation ApiDemos.java ApiDemosApplication.java app appwidget content graphics media os text view
:示例代码介绍了如何使用API和遮挡剔除的可配置项。 :该示例代码提供了供离线超分辨率插件参考或使用的程序。 :该示例代码提供了可供参考或使用插件的程序。 有关更多信息,您可以在每个样本中检出README...
当前大多数搞机器人开发的用户所装的ROS是indigo版本,而且是基于Ubuntu14.04的。如果你跑别的版本的rbx代码老出错,不用怀疑,就是代码版本问题!ros by example for indigo volume 1很多地方(包括CSDN)都可以...
安卓开发例程,内置图形界面开发 硬件开发 nfc 媒体应用开发等官方demo
TDBProgress displays BDE operations progress for IDAPI drivers that support callback-functions. TDBIndexCombo is a visual interface component that provides your end- users with an easy means of ...
Perform AI and Game Logic ..........................................17 Section 5: Render Next Frame ........................................................18 Section 6: Synchronize Display .......
围绕Unity新的实验性Vector API的简单包装,让您就像在HTML5画布中一样进行绘制。 演示基本的填充,笔触和填充规则。 例如: m_Graphics.MoveTo(900, 150);m_Graphics.BezierCurveTo(910, 250, 940, 250, 950, 250);...
android API demo 包括accessibility animation app content graphics media nfc os preference ...
API: MovieEvent()和draw()函数的调用速度不同。 因此,最好在MovieEvent()中进行所有帧处理。 或者,您可以首先保存所有帧,然后将它们作为图像文件顺序加载到draw()中。 删除背景的示例:chp16 / example...
************ WPTOOLS 6 History ************ ********** http://www.wpcubed.com ********* **** Copyright (C) 2012 J. Ziersch and **** **** WPCubed GmbH, Munich, Germany ******** ************************...
6. Using the JavaMail API 13 7. Searching with SearchTerm 21 8. Exercises 22 9. Wrapup 32 Fundamentals of the JavaMail API Page 1 Presented by developerWorks, your source for great ...
这是一个自己整理的详细的英文Raphael 2.2参考文档,压缩包内包含pdf参考文档《Learning Raphael JS Vector Graphics》和示例demo。
RX Library 2.75 =============== The Set of Native Delphi Components for Borland Delphi versions 1, 2, 3, 4 & 5 and Borland C++ Builder 1, 3 & 4. ...5. A couple of simple demo applications.
- Added support for VGA graphics mode with 400 lines (partial fix for SF bug #2948724) - NE2K: Fixed "send buffer" command issue on big endian hosts - USB - converted common USB code plus devices ...
10.8.6. Cascading Write Operations 10.8.6.1. Notes Regarding Cascading Operations 11. Zend_Debug 11.1. 输出变量的值 (Dumping Variables) 12. Zend_Exception 12.1. 使用“异常” 13. Zend_Feed 13.1. ...
as an interval value), and will provide Up and/or Dn graphics to enable navigation between the menu sections.<END><br>40 , CoolExplorer2.zip The new and improved Cool Explorer: Many new functions....