public virtual Sprite GetSprite(Data.Resource resource, uint index, Sprite.Color color) { if (index >= Data.GetResourceCount(resource)) { return(null); } Tuple <Sprite, Sprite> ms = GetSpriteParts(resource, index); Sprite mask = ms.Item1; Sprite image = ms.Item2; if (mask != null) { mask.FillMasked(color); if (image != null) { mask.Blend(image); } return(mask); } return(image); }
unsafe public virtual void Fill(Sprite.Color color) { fixed(byte *pointer = data) { Color *c = (Color *)pointer; for (uint i = 0; i < (width * height); ++i) { *c++ = color; } } }
unsafe public virtual void FillMasked(Sprite.Color color) { fixed(byte *pointer = data) { Color *res = (Color *)pointer; for (uint i = 0; i < width * height; ++i) { if ((res->Alpha & 0xFF) != 0x00) { *res = color; } res++; } } }
public override Sprite GetSprite(Data.Resource resource, uint index, Sprite.Color color) { switch (GraphicDataUsage) { case DataUsage.ForceAmiga: if (!amigaGraphicsOk) { throw new ExceptionFreeserf(ErrorSystemType.Data, "Amiga graphic data not available."); } return(amiga.GetSprite(resource, index, color)); case DataUsage.ForceDos: if (!dosOk) { throw new ExceptionFreeserf(ErrorSystemType.Data, "DOS graphic data not available."); } return(dos.GetSprite(resource, index, color)); case DataUsage.PreferAmiga: if (amigaGraphicsOk) { return(amiga.GetSprite(resource, index, color)); } else { return(dos.GetSprite(resource, index, color)); } case DataUsage.PreferDos: default: if (dosOk) { return(dos.GetSprite(resource, index, color)); } else { return(amiga.GetSprite(resource, index, color)); } } }