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


Java Paint.setARGB方法代码示例

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


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

示例1: MjpegViewThread

import android.graphics.Paint; //导入方法依赖的package包/类
public MjpegViewThread(SurfaceHolder surfaceHolder, View view){
    mSurfaceHolder = surfaceHolder;
    mRun = false;
    mCallback = null;
    dispWidth = view.getWidth();
    dispHeight = view.getHeight();
    prevdispWidth = dispWidth;
    prevdispHeight = dispHeight;
    destRect = new Rect(0,0,dispWidth,dispHeight);
    destSrc = null;
    displayMode = 1; // Default : SIZE_FIT_MODE
    prevdisplayMode = 1;

    bgColor = new Paint();
    bgColor.setStyle(Paint.Style.FILL);
    bgColor.setARGB(255, 0, 0, 0);
}
 
开发者ID:dydwo92,项目名称:Android-Simple-MjpegViewer,代码行数:18,代码来源:MjpegViewThread.java

示例2: drawTextAndBgColorOnBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
private Bitmap drawTextAndBgColorOnBitmap(Bitmap bitmap, FallbackGlideParams params) {
    Canvas canvas = new Canvas(bitmap);

    int rgb = calcUnknownContactColor(params.address);
    bitmap.eraseColor(rgb);

    String letter = calcUnknownContactLetter(params.address);

    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Style.FILL);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(mPictureSizeInPx * 3 / 4); // just scale this down a bit
    Rect rect = new Rect();
    paint.getTextBounds(letter, 0, 1, rect);
    float width = paint.measureText(letter);
    canvas.drawText(letter,
            (mPictureSizeInPx / 2f) - (width / 2f),
            (mPictureSizeInPx / 2f) + (rect.height() / 2f), paint);

    return bitmap;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:ContactPictureLoader.java

示例3: setupFillPaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
 * if the fill should be drawn, {@code false} if not.
 */
protected boolean setupFillPaint(Paint paint, float opacity) {
  if (mFillColor != null && mFillColor.length > 0) {
    paint.reset();
    paint.setFlags(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    int colorType = (int) mFillColor[0];
    switch (colorType) {
      case 0:
        paint.setARGB(
            (int) (mFillColor.length > 4 ? mFillColor[4] * opacity * 255 : opacity * 255),
            (int) (mFillColor[1] * 255),
            (int) (mFillColor[2] * 255),
            (int) (mFillColor[3] * 255));
        break;
      default:
        // TODO(6352048): Support gradients etc.
        FLog.w(ReactConstants.TAG, "ART: Color type " + colorType + " not supported!");
    }
    return true;
  }
  return false;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:ARTShapeShadowNode.java

示例4: drawCircularImageViewBorder

import android.graphics.Paint; //导入方法依赖的package包/类
private void drawCircularImageViewBorder(Canvas canvas){
    Paint paint = new Paint();

    paint.setStyle(Paint.Style.STROKE);

    // set ARGB.
    final int RED = Color.red(borderColor);
    final int GREEN = Color.green(borderColor);
    final int BLUE = Color.blue(borderColor);
    final int ALPHA = Color.alpha(borderColor);

    paint.setStrokeWidth(borderSize);

    paint.setARGB(ALPHA, RED, GREEN, BLUE);

    canvas.drawCircle(radius + getXCenter(), radius + getYCenter(), radius, paint);
}
 
开发者ID:MohamedNagyMostafa,项目名称:IM_Here,代码行数:18,代码来源:CircleImageView.java

示例5: drawCircle

import android.graphics.Paint; //导入方法依赖的package包/类
private Bitmap drawCircle(Bitmap bm) {
    int width = bm.getWidth();
    int height = bm.getHeight();
    int left = 0;
    int top = 0;
    int right = width;
    int bottom = height;
    int roundX = height / 2;
    if (width > height) {
        left = (width - height) / 2;
        top = 0;
        right = left + height;
        bottom = height;
    } else {
        left = 0;
        top = (height - width) / 2;
        right = width;
        bottom = top + width;
        roundX = width / 2;
    }
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Rect rect = new Rect(left, top, right, bottom);
    RectF rectF = new RectF(rect);

    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setARGB(0, 0, 0, 0);
    paint.setColor(Color.GRAY);
    canvas.drawRoundRect(rectF, roundX, roundX, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bm,rect,rect,paint);
    bm.recycle();
    return bitmap;
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:37,代码来源:DoActivity.java

示例6: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context) {
    if (!this.isInEditMode()) {

        splats[0] = BitmapFactory.decodeResource(getResources(), R.drawable.splat1);
        splats[1] = BitmapFactory.decodeResource(getResources(), R.drawable.splat2);
        splats[2] = BitmapFactory.decodeResource(getResources(), R.drawable.splat2);
        anchor[0] = BitmapFactory.decodeResource(getResources(), R.drawable.anchor_sm);
        axes[0] = BitmapFactory.decodeResource(getResources(), R.drawable.axe2);
        bgs[0] = BitmapFactory.decodeResource(getResources(), R.drawable.sea);
        fgtops[0] = BitmapFactory.decodeResource(getResources(), R.drawable.sail);
        fgbottoms[0] = BitmapFactory.decodeResource(getResources(), R.drawable.shipside2);

        final SurfaceHolder holder = getHolder();
        holder.addCallback(this);
        TypedArray fish = getResources().obtainTypedArray(R.array.fish);
        int[] values = getResources().getIntArray(R.array.points);
        totalValue = 0;
        for (int i = 0; i < fish.length(); i++) {
            FlyingItem item = new FlyingItem(BitmapFactory.decodeResource(getResources(), fish.getResourceId(i, 0)));
            item.setValue(values[i]);
            availableItems.add(item);
            totalValue += (100 - values[i]);
        }
        fish.recycle();

        this.setOnTouchListener(this);
        mLinePaint = new Paint();
        mLinePaint.setARGB(255, 255, 64, 64);
        mLinePaint.setStrokeWidth(5);
        mBGPaint = new Paint();
        mBGPaint.setARGB(255, 127, 127, 200);

        mTextPaint = new Paint();
        mTextPaint.setColor(Color.BLACK);
        mTextPaint.setShadowLayer(8,8,8,Color.WHITE);
        mTextPaint.setTextSize(80);

    }
}
 
开发者ID:quaap,项目名称:SeafoodBerserker,代码行数:40,代码来源:MainFishView.java

示例7: createPaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * This method creates the instance of Paint.
 * In addition, this method sets styles for Paint.
 *
 * @return paint This is returned as the instance of Paint
 */
private Paint createPaint() {
  Paint paint = new Paint();

  paint.setAntiAlias(true);
  paint.setStyle(this.paintStyle);
  paint.setStrokeWidth(this.paintStrokeWidth);
  paint.setStrokeCap(this.lineCap);
  paint.setStrokeJoin(Paint.Join.MITER);  // fixed

  // for Text
  if (this.mode == Mode.TEXT) {
    paint.setTypeface(this.fontFamily);
    paint.setTextSize(this.fontSize);
    paint.setTextAlign(this.textAlign);
    paint.setStrokeWidth(0F);
  }

  if (this.mode == Mode.ERASER) {
    // Eraser
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    paint.setARGB(0, 0, 0, 0);

    // paint.setColor(this.baseColor);
    // paint.setShadowLayer(this.blur, 0F, 0F, this.baseColor);
  } else {
    // Otherwise
    paint.setColor(this.paintStrokeColor);
    paint.setShadowLayer(this.blur, 0F, 0F, this.paintStrokeColor);
    paint.setAlpha(this.opacity);
  }

  return paint;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:40,代码来源:CanvasView.java

示例8: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {

        colorPointerPaint = new Paint();
        colorPointerPaint.setStyle(Style.STROKE);
        colorPointerPaint.setStrokeWidth(2f);
        colorPointerPaint.setARGB(128, 0, 0, 0);

        valuePointerPaint = new Paint();
        valuePointerPaint.setStyle(Style.STROKE);
        valuePointerPaint.setStrokeWidth(2f);

        valuePointerArrowPaint = new Paint();

        colorWheelPaint = new Paint();
        colorWheelPaint.setAntiAlias(true);
        colorWheelPaint.setDither(true);

        valueSliderPaint = new Paint();
        valueSliderPaint.setAntiAlias(true);
        valueSliderPaint.setDither(true);

        colorViewPaint = new Paint();
        colorViewPaint.setAntiAlias(true);

        colorViewPath = new Path();
        valueSliderPath = new Path();
        arrowPointerPath = new Path();

        outerWheelRect = new RectF();
        innerWheelRect = new RectF();

        colorPointerCoords = new RectF();

    }
 
开发者ID:MLNO,项目名称:airgram,代码行数:35,代码来源:ColorPicker.java

示例9: Draw

import android.graphics.Paint; //导入方法依赖的package包/类
public void Draw(
        @NonNull Canvas canvas,
        @NonNull Paint paint) {
    canvas.drawRGB(20, 20, 20);
    paint.setARGB(255, 255, 255, 255);

    drawBall(canvas, paint);
    drawBoards(canvas, paint);
    drawPoints(canvas, paint);
    drawInfo(canvas, paint);
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:12,代码来源:GameState.java

示例10: createThumbnailBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
public Bitmap createThumbnailBitmap(AsciiConverter.Result result) {
    int width = outputImageWidth / 4;
    int height = outputImageHeight / 4;
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL);
    paint.setARGB(255, 255, 255, 255);

    canvas.drawARGB(255, 0, 0, 0);
    if (result != null) {
        for (int r = 0; r < result.rows; r += 2) {
            int ymin = height * r / result.rows;
            int ymax = height * (r + 2) / result.rows;
            for (int c = 0; c < result.columns; c += 2) {
                int xmin = width * c / result.columns;
                int xmax = width * (c + 2) / result.columns;
                float ratio = result.brightnessRatioAtRowColumn(r, c);
                paint.setColor(result.colorAtRowColumn(r, c));
                // for full color, always draw larger rectangle because colors will be darker
                if (result.getColorType() == AsciiConverter.ColorType.FULL_COLOR || ratio > 0.5) {
                    canvas.drawRect(xmin, ymin, xmax, ymax, paint);
                } else {
                    int x = (xmin + xmax) / 2 - 1;
                    int y = (ymin + ymax) / 2 - 1;
                    canvas.drawRect(x, y, x + 2, y + 2, paint);
                }
            }
        }
    }
    return bitmap;
}
 
开发者ID:tranleduy2000,项目名称:ascii_generate,代码行数:33,代码来源:AsciiRenderer.java

示例11: PageView

import android.graphics.Paint; //导入方法依赖的package包/类
public PageView(Context ctx, AttributeSet atts) {
	super(ctx, atts);

	scroller = new Scroller(ctx);
	detector = new GestureDetector(ctx, this);
	scaleDetector = new ScaleGestureDetector(ctx, this);

	viewScale = 1;
	minScale = 1;
	maxScale = 2;

	linkPaint = new Paint();
	linkPaint.setARGB(32, 0, 0, 255);

	hitPaint = new Paint();
	hitPaint.setARGB(32, 255, 0, 0);

	errorPaint = new Paint();
	errorPaint.setARGB(255, 255, 80, 80);
	errorPaint.setStrokeWidth(5);
	errorPaint.setStyle(Paint.Style.STROKE);

	errorPath = new Path();
	errorPath.moveTo(-100, -100);
	errorPath.lineTo(100, 100);
	errorPath.moveTo(100, -100);
	errorPath.lineTo(-100, 100);
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-mini,代码行数:29,代码来源:PageView.java

示例12: paintForStrength

import android.graphics.Paint; //导入方法依赖的package包/类
private static Paint paintForStrength(double strength) {
  Paint paint = new Paint();
  int r = (int)(255 * (1 - strength));
  int g = (int)(255 * strength);
  paint.setARGB(255, r, g, 0);
  paint.setStyle(Paint.Style.FILL_AND_STROKE);
  return paint;
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:9,代码来源:ConnectionStrengthView.java

示例13: paintForAge

import android.graphics.Paint; //导入方法依赖的package包/类
private static Paint paintForAge(double age) {
  Paint paint = new Paint();
  int r = (int)(255 * (1 - age));
  int g = (int)(255 * age);
  paint.setARGB(255, r, g, 0);
  paint.setStyle(Paint.Style.FILL_AND_STROKE);
  return paint;
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:9,代码来源:Plot2DView.java

示例14: drawUnderline

import android.graphics.Paint; //导入方法依赖的package包/类
private void drawUnderline(Canvas canvas) {
    if (!(text instanceof Spanned)) {
        return;
    }
    Spanned spanned = (Spanned) text;
    UnderlineSpan[] spans = spanned.getSpans(start, end, UnderlineSpan.class);
    if (spans == null || spans.length == 0) {
        return;
    }
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2); // TODO
    paint.setARGB(0xFF, 0, 0, 0); // TODO
    for (UnderlineSpan span : spans) {
        RectF spanRect = getRect(span);
        if (spanRect == null) {
            continue;
        }
        spanRect.offset(originX, originY);
        if (vertical) {
            float lineX = spanRect.left;
            canvas.drawLine(lineX, spanRect.top, lineX, spanRect.bottom, paint);
        } else {
            float lineY = (spanRect.bottom + originY) / 2;
            canvas.drawLine(spanRect.left, lineY, spanRect.right, lineY, paint);
        }
    }
}
 
开发者ID:geansea,项目名称:GSLayout,代码行数:30,代码来源:GSLayoutLine.java

示例15: drawStrikeThrough

import android.graphics.Paint; //导入方法依赖的package包/类
private void drawStrikeThrough(Canvas canvas) {
    if (!(text instanceof Spanned)) {
        return;
    }
    Spanned spanned = (Spanned) text;
    StrikethroughSpan[] spans = spanned.getSpans(start, end, StrikethroughSpan.class);
    if (spans == null || spans.length == 0) {
        return;
    }
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2); // TODO
    paint.setARGB(0xFF, 0, 0, 0); // TODO
    for (StrikethroughSpan span : spans) {
        RectF spanRect = getRect(span);
        if (spanRect == null) {
            continue;
        }
        spanRect.offset(originX, originY);
        if (vertical) {
            float lineX = (spanRect.left + spanRect.right) / 2;
            canvas.drawLine(lineX, spanRect.top, lineX, spanRect.bottom, paint);
        } else {
            float lineY = (spanRect.top + spanRect.bottom + originY) / 3;
            canvas.drawLine(spanRect.left, lineY, spanRect.right, lineY, paint);
        }
    }
}
 
开发者ID:geansea,项目名称:GSLayout,代码行数:30,代码来源:GSLayoutLine.java


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