Ok, I have a rather strange request.
Due to the inconsistency in how different browsers support text with drop shadow, I was thinking that the text I need with drop shadow (some headers), I could create dynamically on the server side of my web app, and then pass the image to the browser instead of text directly.
I want to use WPF for this, since WPF has a lot of text manipulation built in, and it should be significantly easier to make text with drop shadow in WPF compared to GDI+.
So what I need to do is inside my Web App, create a WPF text element with the drop shadow effect, and save it inside an image (either to disk, or better yes pass it directly to the browser since I actually do not need to store the image since it will be specific for that request only).
I'm hoping for at least some pointers 开发者_StackOverflow社区in the right direction :)
I just want to say, since this is unanswered and I don't use WPF that much, GDI+ would actually be pretty easy:
- Draw text on image using the desired color of the shadow.
- Do a box blur (or Gaussian).
- (optional) Create another bitmap and do basically a watermark style draw (this would allow you to set opacity and thus soften the shadow, etc.)
- Draw text again using color desired for the text
With that you would have yourself text with a drop shadow. There's about 10 different image processing libraries that make it rather simple (I will sadly do some self promotion and just say that Craig's Utility Library has a draw text function and box blur function in the Utilities.Media.Image.Image class, but there's tons of other packages you could use).
精彩评论