Paint Style( Graphics)

Paint style এর মাঝে তিন ধরনের স্টাইল উল্লেখ যোগ্য
LinearGradient
RadialGradient
SweepGradient
তা ছাড়া Paint Style setStyle() use করেও স্টাইল চেঞ্জ করা যায় ।
Paint linePaint = new Paint();
linePaint.setStyle(Paint.Style.STROKE);
এর মাধ্যমে স্টোক দেওয়া যায়।


paintSyle.java

package com.example.graphics2d;

import android.app.Activity;
import android.os.Bundle;

public class paintStyle extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(new style(this));
}

}

style.java
package com.example.graphics2d;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.view.View;

public class style extends View {

public style(Context context) {
super(context);
// TODO Auto-generated constructor stub

}

@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);

canvas.drawColor(Color.BLACK);

Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.STROKE);-----এখানে স্টোক দেওয়া হয়েছে

Typeface face=Typeface.createFromAsset(getContext().getAssets(), "chess1.ttf");

paint.setColor(Color.CYAN);
paint.setTextSize(20);
paint.setTypeface(face);

canvas.drawText("WwQqRr ",20,20, paint);
canvas.drawText("WwQqRr ",20,40, paint);
canvas.drawText("WwQqRr ",20,120, paint);
canvas.drawText("WwQqRr ",20,150, paint);

paint.setColor(Color.RED);
canvas.drawCircle(canvas.getWidth()/2,canvas.getHeight()/2, canvas.getWidth()/3, paint);

}

}four

মন্তব্য করুন

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  পরিবর্তন )

Google photo

You are commenting using your Google account. Log Out /  পরিবর্তন )

Twitter picture

You are commenting using your Twitter account. Log Out /  পরিবর্তন )

Facebook photo

You are commenting using your Facebook account. Log Out /  পরিবর্তন )

Connecting to %s