Hi,
Plz check below sample code
#define WIDTH 800
#define HEIGHT 800
unsigned int *pBuffer;
SkBitmap bitmap;
SkCanvas canvas;
int main()
{
// pBuffer = (unsigned int *) malloc (sizeof(unsigned int) * WIDTH * HEIGHT);
bitmap.setConfig(SkBitmap::kARGB_8888_Config, WIDTH, HEIGHT);
// bitmap.setPixels(pBuffer);
bitmap.allocPixels();
bitmap.eraseColor(SK_ColorWHITE);
canvas.setBitmapDevice(bitmap);
DrawImage();
}
_____________________
void DrawImage()
{
SkBitmap Bitmap;
SkPaint paint;
SkImageDecoder::DecodeFile("E:\\DSC00013.bmp", &Bitmap, SkBitmap::kARGB_8888_Config, SkImageDecoder::kDecodePixels_Mode);
paint.setAntiAlias(true);
paint.setDither(true);
paint.setFilterBitmap(true);
canvas.drawBitmap(Bitmap, 0, 0, &paint);
}
(or)
_____
void DrawImage()
{
SkBitmap Bitmap;
SkPaint paint;
unsigned char *data;
int w, h;
//NOTE::ALLOCATE BUFFER DATA IF U KNOW WIDTH AND HEIGHT
data = (unsigned char *) malloc (sizeof(unsigned char) * 200 * 200 * 4);
//read_bmp("E:\\DSC00013.bmp", data, &w, &h);
//read_bmp("E:\\test.bmp", data, &w, &h);
Bitmap.setConfig(SkBitmap::kARGB_8888_Config, w,h, w * 4);
Bitmap.setPixels(data);
paint.setAntiAlias(true);
paint.setDither(true);
paint.setFilterBitmap(true);
canvas.drawBitmap(Bitmap, 500, 10, &paint);
free(data);
}
__________
Regards,
Chandramouli