/// <summary> /// Generates the image from the specified data buffer position and also use the xfer look up table /// </summary> /// <param name="databuffer">Databuffer.</param> /// <param name="dataOffSet">Data off set.</param> /// <param name="width">Width.</param> /// <param name="height">Height.</param> /// <param name="imageName">Image name.</param> /// <param name="pal">Pal.</param> /// <param name="Alpha">If set to <c>true</c> alpha.</param> public static BitmapUW Image(ArtLoader instance, char[] databuffer, long dataOffSet, int index, int width, int height, string imageName, Palette pal, bool Alpha, bool useXFER, BitmapUW.ImageTypes imgType) { BitmapUW imgUW = new BitmapUW(); imgUW.artdata = instance; imgUW.FileOffset = dataOffSet; imgUW.ImageType = imgType; imgUW.ImagePalette = pal; imgUW.ImageNo = index; if (instance != null) { instance.ImageType = imgType; } Bitmap image = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Byte[] imageColors = new Byte[width * height * 4]; long counter = 0; for (int iRow = 0; iRow < height; iRow++) { for (int j = (iRow * width); j < (iRow * width) + width; j++) { byte pixel = (byte)Util.getValAtAddress(databuffer, dataOffSet + (long)j, 8); Color col = pal.ColorAtPixel(pixel, Alpha); //imageColors[counter++] = pal.ColorAtPixel(pixel, Alpha); imageColors[counter++] = col.B; imageColors[counter++] = col.G; imageColors[counter++] = col.R; imageColors[counter++] = col.A; //image.SetPixel(j- (iRow * width), iRow, pal.ColorAtPixel(pixel, Alpha)); } } //image.filterMode = FilterMode.Point; // image.SetPixels32(imageColors); //image.Apply(); //return image; imgUW.image = CopyDataToBitmap(imageColors, width, height); return(imgUW); }
/// <summary> /// Generates the image from the specified data buffer position /// </summary> /// <param name="databuffer">Databuffer.</param> /// <param name="dataOffSet">Data off set.</param> /// <param name="width">Width.</param> /// <param name="height">Height.</param> /// <param name="imageName">Image name.</param> /// <param name="pal">Pal.</param> /// <param name="Alpha">If set to <c>true</c> alpha.</param> public static BitmapUW Image(ArtLoader instance, char[] databuffer, long dataOffSet, int index, int width, int height, string imageName, Palette pal, bool Alpha, BitmapUW.ImageTypes imgType) { return(Image(instance, databuffer, dataOffSet, index, width, height, imageName, pal, Alpha, false, imgType)); }