android.graphics.PorterDuff,android.graphics.Insets注释翻译
2015-08-08 17:51
375 查看
package android.graphics; public class PorterDuff { // these value must match their native equivalents. See SkPorterDuff.h public enum Mode { /** [0, 0] */ //所绘制不会提交到画布上。 CLEAR (0), /** [Sa, Sc] */ //显示上层绘制图片 SRC (1), /** [Da, Dc] */ //显示下层绘制图片 DST (2), /** [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] */ //正常绘制显示,上下层绘制叠盖。 SRC_OVER (3), /** [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc] */ //上下层都显示。下层居上显示。 DST_OVER (4), /** [Sa * Da, Sc * Da] */ //取两层绘制交集。显示上层。 SRC_IN (5), /** [Sa * Da, Sa * Dc] */ //取两层绘制交集。显示下层。 DST_IN (6), /** [Sa * (1 - Da), Sc * (1 - Da)] */ //取上层绘制非交集部分。 SRC_OUT (7), /** [Da * (1 - Sa), Dc * (1 - Sa)] */ //取下层绘制非交集部分。 DST_OUT (8), /** [Da, Sc * Da + (1 - Sa) * Dc] */ //取下层非交集部分与上层交集部分 SRC_ATOP (9), /** [Sa, Sa * Dc + Sc * (1 - Da)] */ //取上层非交集部分与下层交集部分 DST_ATOP (10), /** [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] */ //异或:去除两图层交集部分 XOR (11), /** [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] */ //取两图层全部区域,交集部分颜色加深 DARKEN (12), /** [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] */ //取两图层全部,点亮交集部分颜色 LIGHTEN (13), /** [Sa * Da, Sc * Dc] */ //取两图层交集部分叠加后颜色 MULTIPLY (14), /** [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] */ //取两图层全部区域,交集部分变为透明色 SCREEN (15), /** Saturate(S + D) */ ADD (16), OVERLAY (17); Mode(int nativeInt) { this.nativeInt = nativeInt; } /** * @hide */ public final int nativeInt; } }
效果如下:
package android.graphics;
/**
* An Insets instance holds four integer offsets which describe changes to the four
* edges of a Rectangle. By convention, positive values move edges towards the
* centre of the rectangle.
* 一个持有四个整数偏移量的插入物,描述了矩形四边的变化。按照惯例,正值朝着矩形中心移动边缘。
* <p>
* Insets are immutable so may be treated as values.
* 插入物是不可改变的,所以可以把它当成值对待。
* @hide
*/
public class Insets {
public static final Insets NONE = new Insets(0, 0, 0, 0);
public final int left;
public final int top;
public final int right;
public final int bottom;
private Insets(int left, int top, int right, int bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
// Factory methods
/**
* Return an Insets instance with the appropriate values.
* 根据合理的值返回插入物
* @param left the left inset
* @param top the top inset
* @param right the right inset
* @param bottom the bottom inset
*
* @return Insets instance with the appropriate values
*/
public static Insets of(int left, int top, int right, int bottom) {
if (left == 0 && top == 0 && right == 0 && bottom == 0) {
return NONE;
}
return new Insets(left, top, right, bottom);
}
/**
* Return an Insets instance with the appropriate values.
* 根据合理的值返回插入物
* @param r the rectangle from which to take the values
*
* @return an Insets instance with the appropriate values
*/
public static Insets of(Rect r) {
return (r == null) ? NONE : of(r.left, r.top, r.right, r.bottom);
}
/**
* Two Insets instances are equal if they belong to the same class and their fields are
* pairwise equal.
* 如果两个插入物具有成对相同的值,判断相等。
* @param o the object to compare this instance with.
*
* @return true iff this object is equal {@code o}
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Insets insets = (Insets) o;
if (bottom != insets.bottom) return false;
if (left != insets.left) return false;
if (right != insets.right) return false;
if (top != insets.top) return false;
return true;
}
@Override
public int hashCode() {
int result = left;
result = 31 * result + top;
result = 31 * result + right;
result = 31 * result + bottom;
return result;
}
@Override
public String toString() {
return "Insets{" +
"left=" + left +
", top=" + top +
", right=" + right +
", bottom=" + bottom +
'}';
}
}
相关文章推荐
- Android基础知识杂记
- 安卓实现登陆
- android socket
- android 里的各种通信方式
- android fragment(2)
- hongyang的博文深入理解Android中的自定义属性 学习笔记
- Parcelable接口的使用
- xml布局内容总结(四)--Android
- Android studio 快捷键分享(Mac osx 10.5+)
- android用户界面之GridView教程实例汇总
- 【Android测试】【第七节】Monkey——源码浅谈
- Android数据手册01:Android颜色码制表
- Android四大组件之BroadCast(续)
- Android widget 之RemoteView
- Android搜索框(保存历史记录和自动匹配)带有ScrollView嵌套ListView阻尼效果
- IntentService与Service用法区别
- android kl文件
- Android性能优化典范 - 第2季
- Android ANR产生原因和解决办法
- android中的任务栈和启动模式的总结