How to clean expand the SKBitmap

satochibisatochibi USMember ✭✭

For example, there is a 2 px * 2 px checkered pattern bitmap with black dots in the upper left and lower right.
If you enlarge it normally, it will blur.
I want to generate a SKBitmap that has a firm jaggy feeling even when enlarged.
As SKBitmap's Resize method is discontinued,
Please tell me as I do not know what to do.

Best Answer

  • satochibisatochibi US ✭✭
    Accepted Answer

    Was self resolved. I implemented using ScalePixels method instead of Resize method.

    //Old
    SKImageInfo srcInfo = new SKImageInfo(
        srcBitmap.Width * scaleValue,
        srcBitmap.Height * scaleValue);
    SKBitmap dstBitmap = srcBitmap.Resize(srcInfo, SKBitmapResizeMethod.Box);
    
    
    //New
    SKBitmap dstBitmap = new SKBitmap(
        new SKImageInfo(
            srcBitmap.Info.Width * scaleValue,
            srcBitmap.Info.Height * scaleValue));
    srcBitmap.ScalePixels(dstBitmap,SKFilterQuality.None);
    

Answers

  • satochibisatochibi USMember ✭✭
    Accepted Answer

    Was self resolved. I implemented using ScalePixels method instead of Resize method.

    //Old
    SKImageInfo srcInfo = new SKImageInfo(
        srcBitmap.Width * scaleValue,
        srcBitmap.Height * scaleValue);
    SKBitmap dstBitmap = srcBitmap.Resize(srcInfo, SKBitmapResizeMethod.Box);
    
    
    //New
    SKBitmap dstBitmap = new SKBitmap(
        new SKImageInfo(
            srcBitmap.Info.Width * scaleValue,
            srcBitmap.Info.Height * scaleValue));
    srcBitmap.ScalePixels(dstBitmap,SKFilterQuality.None);
    
Sign In or Register to comment.