- 浏览: 47194 次
- 性别:
- 来自: 深圳
-
最新评论
//关键字:获取图片轮廓,Shader运用。文字垂直高度获取。 package com.example.android.apis.graphics; import com.example.android.apis.R; import android.app.Activity; import android.content.Context; import android.graphics.*; import android.os.Bundle; import android.view.KeyEvent; import android.view.*; import java.io.InputStream; import java.io.ByteArrayOutputStream; public class AlphaBitmap extends GraphicsActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SampleView(this)); } private static class SampleView extends View { private Bitmap mBitmap; private Bitmap mBitmap2; private Bitmap mBitmap3; private Shader mShader; private static void drawIntoBitmap(Bitmap bm) { float x = bm.getWidth(); float y = bm.getHeight(); Canvas c = new Canvas(bm); Paint p = new Paint(); p.setAntiAlias(true); p.setAlpha(0x80); c.drawCircle(x/2, y/2, x/2, p); p.setAlpha(0x30);//透明度单传 p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));//设置图像重叠模式 p.setTextSize(60); p.setTextAlign(Paint.Align.CENTER); Paint.FontMetrics fm = p.getFontMetrics(); c.drawText("Alpha", x/2, (y-fm.ascent)/2, p);//fm.ascent 文字垂直方向的关键点位置(相对于底线), } public SampleView(Context context) { super(context); setFocusable(true); InputStream is = context.getResources().openRawResource(R.drawable.frog); mBitmap = BitmapFactory.decodeStream(is); mBitmap2 = mBitmap.extractAlpha();//提取透明度,可以获得图像轮廓。 mBitmap3 = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);//创建指定大小BMP drawIntoBitmap(mBitmap3); mShader = new LinearGradient(0, 0, 100, 70, new int[] { Color.RED, Color.GREEN, Color.BLUE }, null, Shader.TileMode.MIRROR);//填充渲染效果,应用到Paint } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); Paint p = new Paint(); float y = 10; p.setColor(Color.BLUE); canvas.drawBitmap(mBitmap, 10, y, p); y += mBitmap.getHeight() + 10; canvas.drawBitmap(mBitmap2, 10, y, p); y += mBitmap2.getHeight() + 10; p.setShader(mShader); canvas.drawBitmap(mBitmap3, 10, y, p); } } }
发表评论
-
图片处理
2012-11-28 02:48 0http://www.linuxidc.com/Linux/2 ... -
Api Demo - .graphics(24)>>Cube
2012-08-03 15:18 1150package com.example.android.api ... -
Api Demo - .graphics(24)>>TouchRotateActivity
2012-08-03 15:07 1039package com.example.android.api ... -
Api Demo - .graphics(23)>>CubeMapActivity
2012-07-31 16:31 1389package com.opengl.test; imp ... -
opengles 学习关键字
2012-07-24 09:35 638主动渲染、平面着色、透视投影、near、索引法、glLight ... -
Api Demo - .graphics(21)>>StaticTriangleRenderer
2012-07-23 17:51 1235package com.example.android.api ... -
Api Demo - .graphics(20)>>CompressedTextureActivity
2012-07-23 16:50 1367/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(19)
2012-07-20 22:45 722package com.example.android.api ... -
Api Demo - .graphics(18)
2012-07-20 10:32 818package com.example.android.api ... -
Api Demo - .graphics(17)
2012-07-19 11:43 933/* package com.example.andro ... -
Api Demo - .graphics(16)
2012-07-18 14:54 600package com.example.android.api ... -
Api Demo - .graphics(15)
2012-07-18 12:55 799package com.example.android.api ... -
Api Demo - .graphics(14)
2012-07-18 11:50 810package com.example.android.api ... -
Api Demo - .graphics(13)
2012-07-17 11:38 903//关键字 Paint,MaskFilte,Path,Xfer ... -
Api Demo - .graphics(12)
2012-07-17 10:44 651<?xml version="1.0" ... -
Api Demo - .graphics(11)
2012-07-17 09:53 784//关键字:Shader ,ShapeDrawable pa ... -
Api Demo - .graphics(10)
2012-07-16 17:59 1042/* * Copyright (C) 2008 The A ... -
Api Demo - .graphics(9)
2012-07-16 11:26 749//关键字:颜色合成,JPEG,PNG图片解压,Bitmap压 ... -
Api Demo - .graphics(8)
2012-07-16 10:43 651//关键字:ColorMatrixColorFilter; ... -
Api Demo - .graphics(7)
2012-07-16 09:53 736// 关键字: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...
1. Scope of this Volume.......................................................................................1 2. Installing the ros-by-example Code......................................................
Tricks of the Windows video Game Programming <br>PART I Windows Programming Foundations 7 1 Journey into the Abyss 9 A Little History.............................................................
安卓开发例程,内置图形界面开发 硬件开发 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 ...
围绕Unity新的实验性Vector API的简单包装,让您就像在HTML5画布中一样进行绘制。 演示基本的填充,笔触和填充规则。 例如: m_Graphics.MoveTo(900, 150);m_Graphics.BezierCurveTo(910, 250, 940, 250, 950, 250);...
19.2.2013 - WPTools 6.29.1 - fix in rtf writing code to solve problem with merged cells - fix possible rangecheck error - fix problem with TextObject.LoadFromFile and Delphi XE3 * RTF reader now ...
android API demo 包括accessibility animation app content graphics media nfc os preference ...
矩阵位移法matlab代码COMP3419图形和多媒体 实验示范 3.1视频背景替换 此任务是访问和修改视频“ monkey.mov”的每一帧,并将蓝色...3.2具有宏块匹配的运动估计(实验提交1) (a)块匹配图 图3.2:块匹配算法和提取的
Fundamentals of the JavaMail API Page 1 Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Section 1. Tutorial tips Should I take this tutorial? Looking to ...
这是一个自己整理的详细的英文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 ...
1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) 2.1.4. 注册角色(Role) 2.1.5. 定义访问...
1 , manc-skinex.zip This is an example of how to add skins to your program.<END><br>2 , irregularForms.zip This is a great example. It takes two images to shape the form, then blits the "face" ...