bdubey
bdubey

Reputation: 307

How to mirror image/preview coming on front camera in my windows 8 phone app

My reference for the app is this link . It uses video brush to render the preview.

http://msdn.microsoft.com/en-us/magazine/hh708750.aspx The guy talks about giving mirror experience for front camera but doesnt explain how. Please help, I a stuck on this for a week now.

Upvotes: 1

Views: 1234

Answers (2)

Milan Aggarwal
Milan Aggarwal

Reputation: 5104

  <Rectangle 
        x:Name="viewfinderRectangle"
        Width="640" 
        Height="480" 
        HorizontalAlignment="Left" 
        Margin="80,0,0,0">
        <Rectangle.Fill>
            <VideoBrush x:Name="videoRecorderBrush" AlignmentX="Left" AlignmentY="Top" Stretch="UniformToFill">
                <VideoBrush.RelativeTransform>
                    <CompositeTransform x:Name="viewfinderTransform" ScaleX="1"
                                        CenterX="0.5" CenterY="0.5"/>
                </VideoBrush.RelativeTransform>
            </VideoBrush>
        </Rectangle.Fill>
    </Rectangle>

When using front camera change ScaleX = -1 and mirror image problem is solved. However the actual video being recorded is still mirror image. Couldn't find any solution to that :(

Upvotes: 1

Nigel Sampson
Nigel Sampson

Reputation: 10609

You can use a Scale Transform to flip the video brush. Below is an example of flipping a Grid horizontally (what you'd need for a mirror).

<Grid>
    <Grid.RenderTransform>
        <CompositeTransform ScaleX="-1"/>
    </Grid.RenderTransform>
</Grid>

Upvotes: 1

Related Questions