Thanks,
Noel
What you need to do is to produce a temporary bitmap that contains your
desired text and then alpha blend your main image with that bitmap ... it's
not that hard to do and I do suspect that there'll be some components around
that might do this ... what you need to do is to scan and darken each pixel
in accordance with the luminance of your temporary bitmap ... white = no
change ... black = black ... a good site to look at is :
there's lots of good stuff on image manipulation ... alpha blending too ...
and you'll need to look at using ScanLine ... Pixels[x, y] will work but
it'd be very slow ...
Andrew
You can use either:
- GDI+
- Graphics32 www.g32.org
The last one is my fav.
If you don't want to use either of these libs you can also just use TBitmap.
Something along these steps
Load Bitmap1:
- this is the original bitmap with your image
- Set it to pf24Bit
Create Bitmap2:
- set it to the size of Bitmap1,
Add Text to bitmap2, with Color = clBlack
Create Bitmap3:
- set it to the size of Bitmap1
- set it to Pixelformat := pf24Bit
- loop through rows, columns
"if Bitmap2.Pixels[Row, Col] = clBlack then"
- Set the color of Bitmap3.Pixels[Row, Col] to a lightened version of
Bitmap1
"else"
- Bitmap3.Pixels[Row, Col] := Bitmap1.Pixels[Row, Col]
You can change the above "Pixels" references with a faster scanline method.
This requires a bit more coding but is a lot faster.
Creating a lightened pixel can be done by changing each of the three
components (Red, Green, Blue) like this:
New := (Old * (255 - Alpha) + 255 * Alpha) div 255;
When Alpha = 255 -> You will have a complete white pixel
When Alpha = 0 -> You will have the original color.
I haven't tested this. You could also look into conversion of the RGB color
to a HSV model, then changing V and then converting back.
Hope that helps,
Nils Haeck
www.simdesign.nl
www.abc-view.com
"Noel" <zz...@oisin.demon.co.uk> wrote in message
news:th0k6vg7r23lj8v91...@4ax.com...
"Noel" <zz...@oisin.demon.co.uk> wrote in message
news:th0k6vg7r23lj8v91...@4ax.com...
1. Measure your text area, copy that much of image and draw text to an
equal size bitmap.
2. Copyrect an equal size part of your original image.
3. Blend both bitmaps using the Tween example.
4. Draw that bitmap back onto original image.