From: "RandomAccess" Newsgroups: borland.public.delphi.graphics References: <3d8adffe@newsgroups.borland.com> <3d8b470f@newsgroups.borland.com> <3d8b48e4$1@newsgroups.borland.com> Subject: Re: Watermark Date: Fri, 20 Sep 2002 19:59:23 +0200 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 195.78.15.155 Message-ID: <3d8b61fc$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1032544764 195.78.15.155 (20 Sep 2002 10:59:24 -0700) Path: newsgroups.borland.com!not-for-mail Xref: newsgroups.borland.com borland.public.delphi.graphics:51398 Todd, 1. Start with your watermark image. Decide on a transparent color and make sure that the transparent parts of your watermark image are this color. Use a bitmap editor to do this. 2. There are 2 techniques you could use (that I can think of). The first involves lightening the watermark image and then adding it to the target canvas. This is not really easy to do if the watermark will be color, but is fairly straight forward for gray watermarks. Here, you simply increase the the RGB color channels towards peak (255). For colored watermarks, this technique is quite difficult to implement properly because most colors will not lighten evenly and you have to write special code to accomodate this problem. The second technique you could use, is to simply perform a transparent alpha blend with a very low opacity value (say 5 - 10%). This is the simplest approach and produces great results. Note that difficulties arise when images contain anti-alaising against a background color different from the target's background color. In other words, if your watermark is a smoothed antialiased image, it should have the same background color as the image you want to combine it with or else the result will be crap. One way to fix this, is to remove the anti-alaising from the outside edges. Another solution is to perform a color replace outside the contour areas of the bitmap. Search for EFG Computer Lab on google. You'll find all the routines you need there. Earl has some excellent sample work projects that explain working with bitmap scanlines really well. Regards