类android.graphics.EmbossMaskFilter源码实例Demo

下面列出了怎么用android.graphics.EmbossMaskFilter的API类实例代码及写法,或者点击链接到github查看源代码。

public FreeHandView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(DEFAULT_COLOR);
    //mPaint.setAlpha(DEFAULT_COLOR);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setXfermode(null);
    mPaint.setAlpha(0xff);

    mEmboss = new EmbossMaskFilter(new float[] {1, 1, 1}, 0.4f, 6, 3.5f);
    mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL);
}
 
源代码2 项目: spanner   文件: Spans.java
/**
 * @see EmbossMaskFilter#EmbossMaskFilter(float[], float, float, float)
 */
public static Span emboss(@NonNull final float[] direction, final float ambient, final float specular, final float blurRadius) {
    return new Span(new SpanBuilder() {
        @Override
        public Object build() {
            return new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius));
        }
    });
}
 
源代码3 项目: text-decorator   文件: TextDecorator.java
public TextDecorator emboss(final float[] direction, final float ambient, final float specular, final float blurRadius, final int start, final int end) {
  checkIndexOutOfBoundsException(start, end);
  decoratedContent.setSpan(new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius)), start, end,
      flags);

  return this;
}
 
源代码4 项目: text-decorator   文件: TextDecorator.java
public TextDecorator emboss(final float[] direction, final float ambient, final float specular, final float blurRadius, final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius)), index, index + text.length(), flags);
    }
  }

  return this;
}
 
private void applyFilter(
    TextView textView, float[] direction, float ambient, float specular, float blurRadius) {
  if (Build.VERSION.SDK_INT >= 11) {
    ViewUtil.setSoftwareLayerType(textView);
  }
  EmbossMaskFilter filter = new EmbossMaskFilter(direction, ambient, specular, blurRadius);
  textView.getPaint().setMaskFilter(filter);
}
 
源代码6 项目: geopaparazzi   文件: EasyPaint.java
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // it removes the title from the actionbar(more space for icons?)
        // this.getActionBar().setDisplayShowTitleEnabled(false);

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        contentView = new MyView(this);
        setContentView(contentView);

        ActionBar ab = getActionBar();
        ab.setTitle("AcrylicPaint");

//        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//        setSupportActionBar(toolbar);
//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);


        // XXX ADDED FOR GEOPAPARAZZI
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            outputFilePath = extras.getString(MediaStore.EXTRA_OUTPUT);
            longitude = extras.getDouble(LONGITUDE);
            latitude = extras.getDouble(LATITUDE);
            altitude = extras.getDouble(ALTITUDE);
        }
        // XXX END ADDED FOR GEOPAPARAZZI

        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setDither(true);
        mPaint.setColor(Color.GREEN);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStrokeWidth(DEFAULT_BRUSH_SIZE);

        // Where did these magic numbers come from? What do they mean? Can I change them? ~TheOpenSourceNinja
        // Absolutely random numbers in order to see the emboss. asd! ~Valerio
        mEmboss = new EmbossMaskFilter(new float[]{1, 1, 1}, 0.4f, 6, 3.5f);

        mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL);

//        if (isFirstTime()) {
//            AlertDialog.Builder alert = new AlertDialog.Builder(this);
//
//            alert.setTitle(R.string.app_name);
//            alert.setMessage(R.string.app_description);
//            alert.setNegativeButton(R.string.continue_fuck,
//                    new DialogInterface.OnClickListener() {
//                        public void onClick(DialogInterface dialog,
//                                            int whichButton) {
//                            Toast.makeText(getApplicationContext(),
//                                    R.string.here_is_your_canvas,
//                                    Toast.LENGTH_SHORT).show();
//                        }
//                    });
//
//            alert.show();
//        } else {
//            Toast.makeText(getApplicationContext(),
//                    R.string.here_is_your_canvas, Toast.LENGTH_SHORT).show();
//        }

        loadFromIntents();
    }
 
 类所在包
 同包方法