public void AddTile(Rectangle bounds, FreeImageAlgorithmsBitmap fib) { if (fib == null) { return; } try { Rectangle imageBounds = TranslateVirtualRectangleToImageRectangle(bounds); if (this.xScaleFactor < 1.0f || this.yScaleFactor < 1.0f) { fib.Rescale(imageBounds.Size, FREE_IMAGE_FILTER.FILTER_BILINEAR); } fib.ConvertToStandardType(true); if (this.forceGreyscale && !fib.IsGreyScale) { fib.ConvertToGreyscale(); } this.image.PasteFromTopLeft(fib, imageBounds.Location, this.blending); } catch (Exception e) { MessageBox.Show(e.Message); } }
private FreeImageAlgorithmsBitmap TileImage(Tile tile) { FreeImageAlgorithmsBitmap fib = tile.LoadFreeImageBitmap(); fib.ConvertToStandardType(true); if (!fib.IsGreyScale) { if (this.channel == FREE_IMAGE_COLOR_CHANNEL.FICC_RGB) { fib.ConvertToGreyscale(); } else { fib.GetChannel(this.channel); } } return(fib); }