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

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » 2D Graphics » Color 
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 = (ImageViewthis.findViewById(R.id.DrawingImageView);
    Bitmap bitmap = Bitmap.createBitmap((intgetWindowManager()
        .getDefaultDisplay().getWidth()(intgetWindowManager()
        .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(199201, 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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.