>>However, until you can point me a function that do alpha
>>blend with a not alpha pre-multiplied tile image into the composed
> frame
>>buffer
>
> SVG - you need to set up a clipping mask (rectangle) to define the
> source tile, but a PNG image is a valid SVG bitmap.
>
> GDI+ - Graphics::DrawImage, set InterpolationModeHighQualityBilinear on
> the Graphics and construct the Image using Bitmap::Bitmap(Istream*,
> true/*useICM*/) where the Istream contains the data of a PNG. The
> Graphics may be a bitmap with an alpha channel - just select the
> relevant pixel format (or you could use PNG I think) or you can just
> render to the device.
>
> I think that covers all the operating systems, doesn't it?
>
> John Bowler <jbowler@ac...>
Thanks for the clues. I have no idea how to configure the Istream *. I am
a little tired tonigh but I will make some tests tomorrow to apply
tile_alpha in one shot.
(See Using a Color Matrix to Set Alpha Values in Images in GDI+)
// Create a Bitmap object and load it with the texture image.
Bitmap bitmap(L"Texture1.jpg");
Pen pen(Color(255, 0, 0, 0), 25);
// Initialize the color matrix.
// Notice the value 0.8 in row 4, column 4.
ColorMatrix colorMatrix =
{1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.8f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
// Create an ImageAttributes object and set its color matrix.
ImageAttributes imageAtt;
imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,
ColorAdjustTypeBitmap);
// First draw a wide black line.
graphics.DrawLine(&pen, Point(10, 35), Point(200, 35));
// Now draw the semitransparent bitmap image.
INT iWidth = bitmap.GetWidth();
INT iHeight = bitmap.GetHeight();
graphics.DrawImage(
&bitmap,
Rect(30, 0, iWidth, iHeight), // Destination rectangle
0, // Source rectangle X
0, // Source rectangle Y
iWidth, // Source rectangle width
iHeight, // Source rectangle height
UnitPixel,
&imageAtt);
_________
/ Adeluc /
¯¯¯¯¯¯¯¯¯
|