Fixed decoding 32bit images, added smoothing for drawing circle progress
parent
d48bc3d81c
commit
d7d90aeb16
|
@ -104,6 +104,7 @@ namespace Resources.Image
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
@ -118,11 +119,11 @@ namespace Resources.Image
|
|||
var bitReader = new BitReader(rowBytes);
|
||||
for (var x = 0; x < _width; x++)
|
||||
{
|
||||
var firstByte = (int)bitReader.ReadByte();
|
||||
var secondByte = (int)bitReader.ReadByte();
|
||||
var b = (byte)(secondByte >> 3 & 0x1f) << 3;
|
||||
var g = (byte)(((firstByte >> 5) & 0x7) | ((secondByte & 0x07) << 3)) << 2;
|
||||
var r = (byte)(firstByte & 0x1f) << 3;
|
||||
var firstByte = (int) bitReader.ReadByte();
|
||||
var secondByte = (int) bitReader.ReadByte();
|
||||
var b = (byte) (secondByte >> 3 & 0x1f) << 3;
|
||||
var g = (byte) (((firstByte >> 5) & 0x7) | ((secondByte & 0x07) << 3)) << 2;
|
||||
var r = (byte) (firstByte & 0x1f) << 3;
|
||||
var color = Color.FromArgb(0xff, r, g, b);
|
||||
context.SetPixel(x, y, color);
|
||||
}
|
||||
|
@ -166,10 +167,10 @@ namespace Resources.Image
|
|||
var rowBytes = _reader.ReadBytes(_rowLengthInBytes);
|
||||
for (var x = 0; x < _width; x++)
|
||||
{
|
||||
var alpha = rowBytes[x * 4];
|
||||
var b = rowBytes[x * 4 + 1];
|
||||
var g = rowBytes[x * 4 + 2];
|
||||
var r = rowBytes[x * 4 + 3];
|
||||
var r = rowBytes[x * 4];
|
||||
var g = rowBytes[x * 4 + 1];
|
||||
var b = rowBytes[x * 4 + 2];
|
||||
var alpha = rowBytes[x * 4 + 3];
|
||||
var color = Color.FromArgb(0xff - alpha, r, g, b);
|
||||
context.SetPixel(x, y, color);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using BumpKit;
|
||||
using WatchFace.Parser.Interfaces;
|
||||
|
@ -66,6 +67,7 @@ namespace WatchFace.Parser
|
|||
var background = resources[0];
|
||||
var preview = new Bitmap(background.Width, background.Height);
|
||||
var graphics = Graphics.FromImage(preview);
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
watchFace.Draw(graphics, resources, state);
|
||||
return preview;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue