Click here to Skip to main content
15,905,238 members
Home / Discussions / WPF
   

WPF

 
QuestionGet element positions Pin
Not Active16-Nov-08 18:33
mentorNot Active16-Nov-08 18:33 
AnswerRe: Get element positions Pin
Michael Sync16-Nov-08 18:57
Michael Sync16-Nov-08 18:57 
GeneralRe: Get element positions Pin
Not Active16-Nov-08 18:59
mentorNot Active16-Nov-08 18:59 
GeneralLearning WPF Pin
ColinM12316-Nov-08 11:11
ColinM12316-Nov-08 11:11 
GeneralRe: Learning WPF Pin
Pete O'Hanlon16-Nov-08 11:18
mvePete O'Hanlon16-Nov-08 11:18 
QuestionDataGrid Pin
VisualLive16-Nov-08 5:33
VisualLive16-Nov-08 5:33 
QuestionAdvanced masking - Interlacing 3 video inputs into a single image [modified] Pin
Graeme_Grant16-Nov-08 2:14
mvaGraeme_Grant16-Nov-08 2:14 
AnswerRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Insincere Dave16-Nov-08 8:57
Insincere Dave16-Nov-08 8:57 
You can get close to what you need using an ImageBrush as the OpacityMask. In the example a 3px wide image is used and tiled and offset.

<Window x:Class="Interlace.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="771" Width="741">
    <Grid SnapsToDevicePixels="True">
        <Rectangle Width="600" Height="400" Fill="Red" x:Name="r"/>
        <Rectangle Width="600" Height="400" Fill="Green" x:Name="g"/>
        <Rectangle Width="600" Height="400" Fill="Blue" x:Name="b" />
    </Grid>
</Window>


private BitmapSource CreateMask(int size)
{
    WriteableBitmap bmp = new WriteableBitmap(size, 1, 96, 96, PixelFormats.Pbgra32, null);

    int[] mask = new int[size];
    int opaque = BitConverter.ToInt32(new byte[] { 255, 255, 255, 255 }, 0), transparent = BitConverter.ToInt32(new byte[] { 255, 255, 255, 0 }, 0);
    mask[0] = opaque;
    for (int i = 1; i < mask.Length; i++)
        mask[i] = transparent;
    bmp.WritePixels(new Int32Rect(0, 0, size, 1), mask, size * 4, 0);
    return bmp;
}


var mask = CreateMask(3);

RenderOptions.SetBitmapScalingMode(g, BitmapScalingMode.NearestNeighbor);
RenderOptions.SetBitmapScalingMode(b, BitmapScalingMode.NearestNeighbor);

b.OpacityMask = new ImageBrush(mask) {TileMode = TileMode.Tile, Viewport = new Rect(0,0,1.0/200,1)};
g.OpacityMask = new ImageBrush(mask) {TileMode = TileMode.Tile, Viewport = new Rect(1.0/600, 0, 1.0 / 200, 1) };


If you zoom in you should see red green and blue 1px stripes, try print-scrn.
If your using video I don't know what to expect, you say you want it pixel perfect but I would be suprised if you could handle 3 HD videos at the same time. I think nearest neighbor interpolation only got added in .NET 3.5 sp1 because of that dependency you might want to try a pixel shader instead, I had some success trying that.
Why can't you do the processing offline and just use a single video?
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Graeme_Grant16-Nov-08 9:39
mvaGraeme_Grant16-Nov-08 9:39 
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Insincere Dave18-Nov-08 5:56
Insincere Dave18-Nov-08 5:56 
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image [modified] Pin
Graeme_Grant19-Nov-08 1:35
mvaGraeme_Grant19-Nov-08 1:35 
QuestionWPF Binding to an attached property from a DataTemplate [modified] Pin
Mark Salsbery14-Nov-08 13:13
Mark Salsbery14-Nov-08 13:13 
AnswerRe: WPF Binding to an attached property from a DataTemplate Pin
Timmy Kokke14-Nov-08 13:46
Timmy Kokke14-Nov-08 13:46 
GeneralRe: WPF Binding to an attached property from a DataTemplate Pin
Mark Salsbery14-Nov-08 14:20
Mark Salsbery14-Nov-08 14:20 
GeneralRe: WPF Binding to an attached property from a DataTemplate Pin
Timmy Kokke14-Nov-08 22:10
Timmy Kokke14-Nov-08 22:10 
GeneralRe: WPF Binding to an attached property from a DataTemplate [modified] Pin
Mark Salsbery15-Nov-08 5:36
Mark Salsbery15-Nov-08 5:36 
AnswerRe: WPF Binding to an attached property from a DataTemplate Pin
Gideon Engelberth14-Nov-08 16:48
Gideon Engelberth14-Nov-08 16:48 
GeneralRe: WPF Binding to an attached property from a DataTemplate Pin
Mark Salsbery15-Nov-08 6:40
Mark Salsbery15-Nov-08 6:40 
QuestionSWF Player in WPF Pin
ctrlnick14-Nov-08 10:25
ctrlnick14-Nov-08 10:25 
AnswerRe: SWF Player in WPF Pin
Pete O'Hanlon14-Nov-08 10:32
mvePete O'Hanlon14-Nov-08 10:32 
GeneralRe: SWF Player in WPF Pin
ctrlnick14-Nov-08 10:54
ctrlnick14-Nov-08 10:54 
QuestionDo we have a something like MASK effect (in SwishMax or Flash) in WPF? Pin
Mohammad Dayyan14-Nov-08 10:14
Mohammad Dayyan14-Nov-08 10:14 
AnswerRe: Do we have sth like MASK effect (in SwishMax or Flash) in WPF? Pin
Pete O'Hanlon14-Nov-08 10:43
mvePete O'Hanlon14-Nov-08 10:43 
GeneralRe: Do we have sth like MASK effect (in SwishMax or Flash) in WPF? Pin
Mohammad Dayyan14-Nov-08 10:48
Mohammad Dayyan14-Nov-08 10:48 
GeneralRe: Do we have sth like MASK effect (in SwishMax or Flash) in WPF? Pin
Pete O'Hanlon14-Nov-08 11:04
mvePete O'Hanlon14-Nov-08 11:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.