Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions HyperTizen/Capturer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ public static string ToImage(Color[] colors)

static SKColor ClampColor(Color color)
{
byte r = (byte)Math.Min(color.R, 255);
byte g = (byte)Math.Min(color.G, 255);
byte b = (byte)Math.Min(color.B, 255);
byte Convert10BitTo8Bit(int value) => (byte)((Math.Clamp(value, 0, 1023) * 255) / 1023);

byte r = Convert10BitTo8Bit(color.R);
byte g = Convert10BitTo8Bit(color.G);
byte b = Convert10BitTo8Bit(color.B);
return new SKColor(r, g, b);
}
}
Expand Down