public Bitmap makeObject(int index, ObjRec[] objects, Bitmap[][] objStrips, MapViewType drawType, int constantSubpal = -1) { var obj = objects[index]; int scaleInt16 = 16; var images = new Image[obj.getSize()]; for (int i = 0; i < obj.getSize(); i++) { int x = i % obj.w; int y = i / obj.w; int pali = (y >> 1) * (obj.w >> 1) + (x >> 1); var objStrip = constantSubpal == -1 ? objStrips[obj.getSubpallete(pali)] : objStrips[constantSubpal]; images[i] = objStrip[obj.indexes[i]]; } var mblock = UtilsGDI.GlueImages(images, obj.w, obj.h); using (Graphics g2 = Graphics.FromImage(mblock)) { if (drawType == MapViewType.ObjType) { g2.FillRectangle(new SolidBrush(CadObjectTypeColors[obj.getType()]), new Rectangle(0, 0, scaleInt16, scaleInt16)); g2.DrawString(String.Format("{0:X}", obj.getType()), new Font("Arial", 6), Brushes.White, new Point(0, 0)); } else if (drawType == MapViewType.ObjNumbers) { g2.FillRectangle(new SolidBrush(Color.FromArgb(192, 255, 255, 255)), new Rectangle(0, 0, scaleInt16, scaleInt16)); g2.DrawString(String.Format("{0:X}", index), new Font("Arial", 6), Brushes.Red, new Point(0, 0)); } } return(mblock); }
public Bitmap makeObjectsStrip(int videoPageId, int tilesId, int palId, MapViewType drawType, int constantSubpal = -1) { var bitmaps = makeObjects(videoPageId, tilesId, palId, drawType, constantSubpal); return(UtilsGDI.GlueImages(bitmaps, bitmaps.Length, 1)); }
public Bitmap makeImageRectangle(byte[] videoChunk, byte[] pallete, int subPalIndex, bool withAlpha = false) { var images = Enumerable.Range(0, 256).Select(i => makeImage(i, videoChunk, pallete, subPalIndex, withAlpha)); return(UtilsGDI.GlueImages(images.ToArray(), 16, 16)); }