Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: How to overlay a tiled pattern on a solid background?

$
0
0
Thanks for your help , that indeed is cleaner. This is how I did it with gdi+ if anyone is interested
    Bitmap tilePatternBitmap = new Bitmap("connect.png");
    Bitmap tiledPatternBitmap = new Bitmap(1440, 900);

    using (TextureBrush brush = new TextureBrush(tilePatternBitmap, WrapMode.Tile))
    using (Graphics g = Graphics.FromImage(tiledPatternBitmap))
    {
        g.FillRectangle(brush, 0, 0, tiledPatternBitmap.Width, tiledPatternBitmap.Height);
    }

    MagickImage pattern = new MagickImage(tiledPatternBitmap);
    pattern.Alpha(AlphaOption.Set);
    pattern.QuantumOperator(Channels.Alpha, EvaluateOperator.Set, Quantum.Max / 2);

    using (MagickImage wallpaper = new MagickImage(new MagickColor("#2980b9"),1440,900)) {
        wallpaper.Composite(pattern, Gravity.Center, CompositeOperator.Dissolve, "50");
        wallpaper.Write("test.png");
    }
    pattern.Dispose();

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>