views:

278

answers:

1

I am now writing a image viewer, It is used for view thumbnails. As it is ugly, I decide to draw shadow round thumbnail.

There is background color. I am using StretchDIBits to draw a shadow image at the location of thumbnail. However it is really annoying that it cover the background color... When the background is white, it looks perfect. but if the backgound is not white, it has a white border.

so I make use of AlphaBlend, first draw the shadow image onto a DC, then use AlphaBlend onto the background. However, I can still see the white border.

Is there any why to generate a perfect shadow , no matter what background is.

A: 

Are you sure the shadow bitmap contains alpha values for the alpha channel ? I.o.w.: how are you creating the shadow bitmap: are you doing that by blurring a square on a transparent target or a white target? If the first, the shadow bitmap contains an alpha channel and should blend fine with the background. if the second, your shadow bitmap contains white fragments and thus will blend that white with the background.

Frans Bouma