private void PaintWithOpacity( Graphics rawGraphics, Image image, Rectangle bounds, float opacity) { ImageAttributes opacityAttributes = RadGdiGraphics.GetOpacityAttributes(opacity); int width1 = image.Width; int height1 = image.Height; switch (this.ImageLayout) { case ImageLayout.None: int width2 = bounds.Width; int height2 = bounds.Height; rawGraphics.DrawImage(image, bounds, 0, 0, width2, height2, GraphicsUnit.Pixel, opacityAttributes); break; case ImageLayout.Tile: for (int x = bounds.X; x <= bounds.Height; x += image.Height) { for (int y = bounds.Y; y <= bounds.Width; y += image.Width) { Rectangle destRect = new Rectangle(y, x, width1, height1); rawGraphics.DrawImage(image, destRect, 0, 0, width1, height1, GraphicsUnit.Pixel, opacityAttributes); } } break; default: rawGraphics.DrawImage(image, bounds, 0, 0, width1, height1, GraphicsUnit.Pixel, opacityAttributes); break; } opacityAttributes.Dispose(); }
private void PaintWithOpacity(Graphics rawGraphics, Image image, Rectangle bounds, float opacity) { ImageAttributes attributes = RadGdiGraphics.GetOpacityAttributes(opacity); int srcWidth = image.Width; int srcHeight = image.Height; switch (this.ImageLayout) { case ImageLayout.None: srcWidth = bounds.Width; srcHeight = bounds.Height; rawGraphics.DrawImage(image, bounds, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, attributes); break; case ImageLayout.Tile: for (int y = bounds.X; y <= bounds.Height; y += image.Height) { for (int x = bounds.Y; x <= bounds.Width; x += image.Width) { Rectangle destRect = new Rectangle(x, y, srcWidth, srcHeight); rawGraphics.DrawImage(image, destRect, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, attributes); } } break; default: rawGraphics.DrawImage(image, bounds, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, attributes); break; } attributes.Dispose(); }