mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
add image.cs
This commit is contained in:
@@ -71,6 +71,8 @@ namespace GameRes
|
|||||||
BgrX = 6,
|
BgrX = 6,
|
||||||
RgbA = 9,
|
RgbA = 9,
|
||||||
BgrA = 10,
|
BgrA = 10,
|
||||||
|
RgbX_Disposed = 55,
|
||||||
|
BgrX_Disposed = 66,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImageData
|
public class ImageData
|
||||||
@@ -213,14 +215,18 @@ namespace GameRes
|
|||||||
int src = 0;
|
int src = 0;
|
||||||
var color_map = new Color[colors];
|
var color_map = new Color[colors];
|
||||||
Func<int, Color> get_color;
|
Func<int, Color> get_color;
|
||||||
if (PaletteFormat.Bgr == format || PaletteFormat.BgrX == format)
|
if (PaletteFormat.Bgr == format || PaletteFormat.BgrX_Disposed == format)
|
||||||
get_color = x => Color.FromRgb (palette_data[x+2], palette_data[x+1], palette_data[x]);
|
get_color = x => Color.FromRgb (palette_data[x+2], palette_data[x+1], palette_data[x]);
|
||||||
|
else if (PaletteFormat.BgrX == format)
|
||||||
|
get_color = x => Color.FromArgb(palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x+2], palette_data[x+1], palette_data[x]);
|
||||||
else if (PaletteFormat.BgrA == format)
|
else if (PaletteFormat.BgrA == format)
|
||||||
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x+2], palette_data[x+1], palette_data[x]);
|
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x+2], palette_data[x+1], palette_data[x]);
|
||||||
else if (PaletteFormat.RgbA == format)
|
else if (PaletteFormat.RgbA == format)
|
||||||
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x], palette_data[x+1], palette_data[x+2]);
|
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x], palette_data[x+1], palette_data[x+2]);
|
||||||
|
else if (PaletteFormat.RgbX == format)
|
||||||
|
get_color = x => Color.FromArgb (palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x], palette_data[x+1], palette_data[x+2]);
|
||||||
else
|
else
|
||||||
get_color = x => Color.FromRgb (palette_data[x], palette_data[x+1], palette_data[x+2]);
|
get_color = x => Color.FromRgb (palette_data[x], palette_data[x+1], palette_data[x+2]);
|
||||||
|
|
||||||
for (int i = 0; i < colors; ++i)
|
for (int i = 0; i < colors; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user