qakmak
qakmak

Reputation: 1377

Is there possible add aero effect in Control itself in WPF?

I have a WriteableBitmap that would display video in the Window. Currently I need to covert the subtitle in the bottom. I want to use a aero effect, but only cover the bottom of the WriteableBitmap.

Which mean, this is the original :

enter image description here

And I want to add a Grid Control which has aero effect, like This:

enter image description here

But I don't know how, I already think about take the picture bottom place and use some effect , and then put it on the top, But It looks a low performance for writableBitmap, because which mean it need to process 25 around picture every second...

Update: Here is my code:

<Grid>
    <Image x:Name="imgFrame"/>
</Grid>

private WriteableBitmap bitmap;

private void OnVideoFrameRunning(FrameArgs e)
{
   if (null == bitmap)
   {
       bitmap = new WriteableBitmap(e.Width, e.Height, 72, 72,PixelFormats.Bgr24, null);
       imgFrame.Source = bitmap;
   }

  bitmap.WritePixels(new Int32Rect(0, 0, e.Width, e.Height), e.Buffer, e.Width * 3, 0, 0);
}

Upvotes: 4

Views: 250

Answers (1)

Nikola.Lukovic
Nikola.Lukovic

Reputation: 1325

You could do something like this:

<Grid>
    <Grid.Effect>
        <BlurEffect Radius="18"/>
    </Grid.Effect>
    <TextBlock HorizontalAlignment="Center"
               VerticalAlignment="Bottom"
               FontSize="40"
               Foreground="#444444"
               Text="Some Subtitles"
               Margin="0 0 0 20"/>
</Grid>

Radius="0": Radius="0"

Radius="18":

Radius="18"

Upvotes: 2

Related Questions