当前位置: 首页>>代码示例>>Java>>正文


Java ColorMatrix.set方法代码示例

本文整理汇总了Java中android.graphics.ColorMatrix.set方法的典型用法代码示例。如果您正苦于以下问题:Java ColorMatrix.set方法的具体用法?Java ColorMatrix.set怎么用?Java ColorMatrix.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.ColorMatrix的用法示例。


在下文中一共展示了ColorMatrix.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FriskyContrast

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public static Bitmap FriskyContrast(Bitmap bitmap,int Value)
{
    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.set(new float[] {
            Value, 0, 0, 0, 1,
            0, Value, 0, 0, 1,
            0, 0, Value, 0, 1,
            0, 0, 0, Value, 0   });

    Bitmap BrightedImage = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap
            .getConfig());
    Canvas canvas = new Canvas(BrightedImage);
    Paint paint = new Paint();
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
    canvas.drawBitmap(bitmap, 0, 0, paint);
    return BrightedImage;

}
 
开发者ID:Dwijraj,项目名称:FriskyImage,代码行数:19,代码来源:FriskyImageProperty.java

示例2: FriskyBright

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public static   Bitmap FriskyBright(Bitmap mBitmap,int fb) {
    ColorMatrix colorMatrix = new ColorMatrix();
     colorMatrix.set(new float[] {
            1, 0, 0, 0, fb,
            0, 1, 0, 0, fb,
            0, 0, 1, 0, fb,
            0, 0, 0, 1, 0   });

    Bitmap BrightedImage = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap
            .getConfig());
    Canvas canvas = new Canvas(BrightedImage);
    Paint paint = new Paint();
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
    canvas.drawBitmap(mBitmap, 0, 0, paint);
    return BrightedImage;

}
 
开发者ID:Dwijraj,项目名称:FriskyImage,代码行数:18,代码来源:FriskyImageProperty.java

示例3: SimulationPageAnim

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public SimulationPageAnim(int w, int h, View view, OnPageChangeListener listener) {
    super(w, h, view, listener);
    mPath0 = new Path();
    mPath1 = new Path();
    mMaxLength = (float) Math.hypot(mScreenWidth, mScreenHeight);
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);

    createDrawable();

    ColorMatrix cm = new ColorMatrix();//设置颜色数组
    float array[] = { 1, 0, 0, 0, 0,
            0, 1, 0, 0, 0,
            0, 0,1, 0, 0,
            0, 0, 0, 1, 0 };
    cm.set(array);
    mColorMatrixFilter = new ColorMatrixColorFilter(cm);
    mMatrix = new Matrix();

    mTouchX = 0.01f; // 不让x,y为0,否则在点计算时会有问题
    mTouchY = 0.01f;
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:23,代码来源:SimulationPageAnim.java

示例4: SimulationPageAnim

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public SimulationPageAnim(int w, int h, View view, OnPageChangeListener listener) {
    super(w, h, view, listener);
    mPath0 = new Path();
    mPath1 = new Path();
    mMaxLength = (float) Math.hypot(mScreenWidth, mScreenHeight);
    mPaint = new Paint();

    mPaint.setStyle(Paint.Style.FILL);

    createDrawable();

    ColorMatrix cm = new ColorMatrix();//设置颜色数组
    float array[] = { 1, 0, 0, 0, 0,
            0, 1, 0, 0, 0,
            0, 0,1, 0, 0,
            0, 0, 0, 1, 0 };
    cm.set(array);
    mColorMatrixFilter = new ColorMatrixColorFilter(cm);
    mMatrix = new Matrix();

    mTouchX = 0.01f; // 不让x,y为0,否则在点计算时会有问题
    mTouchY = 0.01f;
}
 
开发者ID:newbiechen1024,项目名称:NovelReader,代码行数:24,代码来源:SimulationPageAnim.java

示例5: contrastBitmap

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
static Bitmap contrastBitmap(Bitmap bitmap, float contrast) {
    float[] colorTransform = new float[]{
            contrast, 0, 0, 0, 0,
            0, contrast, 0, 0, 0,
            0, 0, contrast, 0, 0,
            0, 0, 0, 1, 0};

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    colorMatrix.set(colorTransform);

    ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
    Paint paint = new Paint();
    paint.setColorFilter(colorFilter);

    Bitmap resultBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, paint);

    return resultBitmap;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:22,代码来源:Utils.java

示例6: brightBitmap

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public static Bitmap brightBitmap(Bitmap bitmap, int brightness) {
    float[] colorTransform = {
            1, 0, 0, 0, brightness,
            0, 1, 0, 0, brightness,
            0, 0, 1, 0, brightness,
            0, 0, 0, 1, 0};

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    colorMatrix.set(colorTransform);

    ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
    Paint paint = new Paint();
    paint.setColorFilter(colorFilter);


    Bitmap resultBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, paint);

    return resultBitmap;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:23,代码来源:Utils.java

示例7: contrastBitmap

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public static Bitmap contrastBitmap(Bitmap bitmap, int contrast) {
    float[] colorTransform = {
            contrast, 0, 0, 0, 1,
            0, contrast, 0, 0, 1,
            0, 0, contrast, 0, 1,
            0, 0, 0, 1, 0};

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    colorMatrix.set(colorTransform);

    ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
    Paint paint = new Paint();
    paint.setColorFilter(colorFilter);


    Bitmap resultBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, paint);

    return resultBitmap;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:23,代码来源:Utils.java

示例8: brightBitmap

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
static Bitmap brightBitmap(Bitmap bitmap, float brightness) {
    float[] colorTransform = {
            1, 0, 0, 0, brightness,
            0, 1, 0, 0, brightness,
            0, 0, 1, 0, brightness,
            0, 0, 0, 1, 0};

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    colorMatrix.set(colorTransform);

    ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
    Paint paint = new Paint();
    paint.setColorFilter(colorFilter);


    Bitmap resultBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, paint);

    return resultBitmap;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:23,代码来源:Utils.java

示例9: PageWidget

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public PageWidget(Context context, String bookId,
                  List<BookMixAToc.mixToc.Chapters> chaptersList,
                  OnReadStateChangeListener listener) {
    super(context, bookId, chaptersList, listener);
    mPath0 = new Path();
    mPath1 = new Path();
    mMaxLength = (float) Math.hypot(mScreenWidth, mScreenHeight);
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);

    createDrawable();

    ColorMatrix cm = new ColorMatrix();//设置颜色数组
    float array[] = {0.55f, 0, 0, 0, 80.0f, 0, 0.55f, 0, 0, 80.0f, 0, 0, 0.55f, 0, 80.0f, 0, 0, 0, 0.2f, 0};
    cm.set(array);
    mColorMatrixFilter = new ColorMatrixColorFilter(cm);
    mMatrix = new Matrix();

    mTouch.x = 0.01f; // 不让x,y为0,否则在点计算时会有问题
    mTouch.y = 0.01f;
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:22,代码来源:PageWidget.java

示例10: handleImageGrayEffect

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
public static Bitmap handleImageGrayEffect(Bitmap bitmap) {
  Bitmap bmp =
      Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
  float[] colorMatrixValue = new float[] {
      0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0, 0, 0, 0, 1,
      0
  };
  ColorMatrix colorMatrix = new ColorMatrix();
  colorMatrix.set(colorMatrixValue);

  Canvas canvas = new Canvas(bmp);
  Paint paint = new Paint();
  paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
  canvas.drawBitmap(bitmap, 0, 0, paint);
  return bmp;
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:17,代码来源:ImageHelper.java

示例11: createSLD

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
 * 设置Selector。 本次只增加点击变暗的效果,注释的代码为更多的效果
 */
public static StateListDrawable createSLD(Context context, Drawable drawable) {
    StateListDrawable bg = new StateListDrawable();
    int brightness = 50 - 127;
    ColorMatrix cMatrix = new ColorMatrix();
    cMatrix.set(new float[]{1, 0, 0, 0, brightness, 0, 1, 0, 0,
            brightness,// 改变亮度
            0, 0, 1, 0, brightness, 0, 0, 0, 1, 0});

    Paint paint = new Paint();
    paint.setColorFilter(new ColorMatrixColorFilter(cMatrix));

    Drawable normal = drawable;
    Drawable pressed = createDrawable(drawable, paint);
    bg.addState(new int[]{android.R.attr.state_pressed,}, pressed);
    bg.addState(new int[]{android.R.attr.state_focused,}, pressed);
    bg.addState(new int[]{android.R.attr.state_selected}, pressed);
    bg.addState(new int[]{}, normal);
    return bg;
}
 
开发者ID:dscn,项目名称:ktball,代码行数:23,代码来源:CommonUtil.java

示例12: generateGrayImage

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
 * 灰色效果
 */
public static Bitmap generateGrayImage(Bitmap bm) {
    Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();

    float[] matrixs = new float[] { 0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0,
            0, 0, 0, 1, 0 };

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.set(matrixs);
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));

    canvas.drawBitmap(bm, 0, 0, paint);

    return bitmap;
}
 
开发者ID:sunxu3074,项目名称:imooc-practice-android,代码行数:20,代码来源:ImageUtils.java

示例13: revertImage

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
 * 图像反转
 */
public static Bitmap revertImage(Bitmap bm) {
    Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();

    float[] matrixs = new float[] { -1, 0, 0, 1, 1, 0, -1, 0, 1, 1, 0, 0, -1, 1, 1, 0, 0, 0, 1, 0 };

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.set(matrixs);
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));

    canvas.drawBitmap(bm, 0, 0, paint);

    return bitmap;
}
 
开发者ID:sunxu3074,项目名称:imooc-practice-android,代码行数:19,代码来源:ImageUtils.java

示例14: memoriesImage

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
 * 怀旧效果
 */
public static Bitmap memoriesImage(Bitmap bm) {
    Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();

    float[] matrixs = new float[] { 0.393f, 0.769f, 0.189f, 0, 0, 0.349f, 0.686f, 0.168f, 0, 0, 0.272f, 0.534f,
            0.134f, 0, 0, 0, 0, 0, 1, 0 };

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.set(matrixs);
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));

    canvas.drawBitmap(bm, 0, 0, paint);

    return bitmap;
}
 
开发者ID:sunxu3074,项目名称:imooc-practice-android,代码行数:20,代码来源:ImageUtils.java

示例15: desaturateImage

import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
 * 去色效果
 */
public static Bitmap desaturateImage(Bitmap bm) {
    Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();

    float[] matrixs = new float[] { 1.5f, 1.5f, 1.5f, 0, -1, 1.5f, 1.5f, 1.5f, 0, -1, 1.5f, 1.5f, 1.5f, 0, -1, 0, 0,
            0, 1, 0 };

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.set(matrixs);
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));

    canvas.drawBitmap(bm, 0, 0, paint);

    return bitmap;
}
 
开发者ID:sunxu3074,项目名称:imooc-practice-android,代码行数:20,代码来源:ImageUtils.java


注:本文中的android.graphics.ColorMatrix.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。