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