Set color for Paint : Color « 2D Graphics « Android






Set color for Paint

  
package app.test;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.ImageView;

public class Test extends Activity {
  ImageView drawingImageView;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    drawingImageView = (ImageView) this.findViewById(R.id.DrawingImageView);
    Bitmap bitmap = Bitmap.createBitmap((int) getWindowManager()
        .getDefaultDisplay().getWidth(), (int) getWindowManager()
        .getDefaultDisplay().getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    drawingImageView.setImageBitmap(bitmap);

    Paint paint = new Paint();
    paint.setColor(Color.GREEN);
    paint.setStrokeWidth(100);
    canvas.drawPoint(199, 201, paint);

  }
}

   
    
  








Related examples in the same category

1.Using solid color to paint
2.Create Color from RGB value
3.Load Color from resource xml file
4.Using View to display color
5.Change check box color
6.Color Filters
7.Color Matrix Sample
8.HSV To Color
9.RGB To Color
10.lighten Color
11.Get Random Location and Colors
12.Returns the complimentary (opposite) color.
13.brighter a color
14.darker a color
15.extends View to create ColorCircle
16.Increase Red
17.Increase Contrast, Reduce Brightness
18.Decrease Saturation