How to simulate shadow around StretchDIBits thumbnails?

Now I am writing an image viewer, it is used to view the thumbnails. Since this is ugly, I decide to paint shadows around the miniature.

There is a background color. I am using StretchDIBits to draw a shadow image at the location of the thumbnail. However, it is really annoying that it covers 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 use AlphaBlend, first draw a shadow image on the DC and then use AlphaBlend on the background. However, I can still see the white border.

Are there any reasons for creating the perfect shadow, no matter what the background.

0


source to share


1 answer


Are you sure the shadow bitmap contains alpha values โ€‹โ€‹for the alpha channel? Iow: how do you create a shadow bitmap: do you do this by blurring a square on a transparent target or a white target? If the former, the shadow bitmap contains an alpha channel and should blend well with the background. if the second, shadow bitmap contains white patches and thus blends that white background with the background.



0


source







All Articles