public override T Get <T>(string name) { if (DataList == null) { return(default(T)); } if (!DataList.ContainsKey(name)) { return(default(T)); } return((T)DataList[name]); }
public bool GetFromBin <T>(string name, out T exist) { exist = default(T); if (DataList == null) { return(false); } if (!DataList.ContainsKey(name)) { return(false); } exist = (T)DataList[name]; return(true); }
private void ReadFONT(FNT FNT) { Height = FNT.Header.Glyphs.Size1; Width = FNT.Header.Glyphs.Size2; Palette = FNT.Palette.Pallete; if (FNT.Header.Glyphs.BitsPerPixel == 4) { PixelFormat = PixelFormats.Indexed4; } else if (FNT.Header.Glyphs.BitsPerPixel == 8) { PixelFormat = PixelFormats.Indexed8; } else { throw new Exception("ReadFONT Error: unknown PixelFormat"); } var DecList = FNT.Compressed.GetDecompressedData(); if (FNT.Header.Glyphs.BitsPerPixel == 4) { ArrayTool.ReverseByteInList(DecList); } for (int i = 0; i < DecList.Count; i++) { var Cut = FNT.WidthTable[i] == null ? new VerticalCut(0, (byte)Width) : FNT.WidthTable[i].Value; int index = i + 32; if (DataList.ContainsKey(index)) { DataList[index] = DecList[i]; } else { DataList.Add(index, DecList[i]); } if (CutList.ContainsKey(index)) { CutList[index] = Cut; } else { CutList.Add(index, Cut); } } }
public Tuple <byte[], VerticalCut> GetGlyph(int index) { byte[] data = null; VerticalCut verticalCut = new VerticalCut(); if (DataList.ContainsKey(index)) { data = DataList[index]; } if (CutList.ContainsKey(index)) { verticalCut = CutList[index]; } return(new Tuple <byte[], VerticalCut>(data, verticalCut)); }