Uncensored-HackerCoding-GPT
/
app
/src
/main
/java
/com
/tacticmaster
/board
/AntialiasedImageView.java
| package com.tacticmaster.board; | |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Canvas; | |
| import android.graphics.Paint; | |
| import android.util.AttributeSet; | |
| import androidx.annotation.Nullable; | |
| import androidx.appcompat.widget.AppCompatImageView; | |
| import com.tacticmaster.R; | |
| public class AntialiasedImageView extends AppCompatImageView { | |
| private Paint paint; | |
| private Bitmap bitmap; | |
| public AntialiasedImageView(Context context) { | |
| super(context); | |
| init(); | |
| } | |
| public AntialiasedImageView(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| init(); | |
| } | |
| public AntialiasedImageView(Context context, AttributeSet attrs, int defStyleAttr) { | |
| super(context, attrs, defStyleAttr); | |
| init(); | |
| } | |
| private void init() { | |
| paint = new Paint(); | |
| paint.setAntiAlias(true); | |
| paint.setFilterBitmap(true); | |
| paint.setDither(true); | |
| bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_white_turn); | |
| } | |
| protected void onDraw(Canvas canvas) { | |
| super.onDraw(canvas); | |
| if (bitmap != null) { | |
| canvas.drawBitmap(bitmap, 0, 0, paint); | |
| } | |
| } | |
| } |