本文整理汇总了C#中System.Windows.Media.VideoBrush类的典型用法代码示例。如果您正苦于以下问题:C# VideoBrush类的具体用法?C# VideoBrush怎么用?C# VideoBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoBrush类属于System.Windows.Media命名空间,在下文中一共展示了VideoBrush类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VideoService
public VideoService(
Rectangle viewFinder,
MediaElement player
)
{
// Initial State
_State = PlayState.Paused;
_CanRecord = false;
_Record = new SwitchableCommand(OnRecord);
_Play = new SwitchableCommand(OnPlay);
_Stop = new SwitchableCommand(OnPause);
_ViewFinder = viewFinder;
_Player = player;
_Player.MediaEnded += MediaEnded;
_CaptureSource = new CaptureSource();
_CaptureSource.CaptureFailed += CaptureFailed;
_FileSink = new FileSink();
_Brush = new VideoBrush();
_HasRecording = new BehaviorSubject<bool>(false);
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Delayed due to Camera init bug in WP71 SDK Beta 2
// See http://forums.create.msdn.com/forums/p/85830/516843.aspx
Dispatcher.BeginInvoke(() =>
{
// Initialize the webcam
photoCamera = new PhotoCamera();
photoCamera.Initialized += PhotoCameraInitialized;
CameraButtons.ShutterKeyHalfPressed += PhotoCameraButtonHalfPress;
isInitialized = false;
isDetecting = false;
// Fill the Viewport Rectangle with the VideoBrush
var vidBrush = new VideoBrush();
vidBrush.SetSource(photoCamera);
Viewport.Fill = vidBrush;
// Start timer
dispatcherTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(50)};
dispatcherTimer.Tick += (sender, e1) => Detect();
dispatcherTimer.Start();
});
}
示例3: Load
void Load()
{
if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
CaptureDeviceConfiguration.RequestDeviceAccess())
{
var devices = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();
foreach (var device in devices)
{
var videoItem = new VideoItem();
videoItem.Name = device.FriendlyName;
var source = new CaptureSource();
source.VideoCaptureDevice = device;
var videoBrush = new VideoBrush();
videoBrush.SetSource(source);
videoItem.Brush = videoBrush;
this.sources.Add(source);
this.sourceItems.Add(videoItem);
}
this.videoItems.ItemsSource = this.sourceItems;
this.StartAll();
}
}
示例4: StartWebCam
public void StartWebCam()
{
_captureSource = new CaptureSource();
_captureSource.CaptureImageCompleted += new EventHandler<CaptureImageCompletedEventArgs>(_captureSource_CaptureImageCompleted);
_captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
try
{
// Start capturing
if (_captureSource.State != CaptureState.Started)
{
// Create video brush and fill the WebcamVideo rectangle with it
var vidBrush = new VideoBrush();
vidBrush.Stretch = Stretch.Uniform;
vidBrush.SetSource(_captureSource);
WebcamVideo.Fill = vidBrush;
// Ask user for permission and start the capturing
if (CaptureDeviceConfiguration.RequestDeviceAccess())
{
_captureSource.Start();
}
}
}
catch (InvalidOperationException)
{
InfoTextBox.Text = "Web Cam already started - if not, I can't find it...";
}
catch (Exception)
{
InfoTextBox.Text = "Could not start web cam, do you have one?";
}
}
示例5: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/EjemploCaptureSource;component/MainPage.xaml", System.UriKind.Relative));
this.BrochaVideo = ((System.Windows.Media.VideoBrush)(this.FindName("BrochaVideo")));
}
示例6: Destructive
public void Destructive ()
{
VideoBrush vb = new VideoBrush ();
// from this instance we can change all default values
BrushTest.DestructiveRelativeTransform (vb);
BrushTest.DestructiveTransform (vb);
// but it's safe to execute since we revert the changes
}
示例7: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Ejemplo%20Leer%20C%C3%B3digo%20Barras;component/MainPage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.VideoBrushBackground = ((System.Windows.Media.VideoBrush)(this.FindName("VideoBrushBackground")));
}
示例8: MainPage_Loaded
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
captureSource = new CaptureSource
{
VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
};
var videoBrush = new VideoBrush();
videoBrush.SetSource(captureSource);
Viewport.Fill = videoBrush;
markerDetector = new CaptureSourceMarkerDetector();
var marker = Marker.LoadFromResource("Bola.pat", 64, 64, 80);
markerDetector.Initialize(captureSource, 1d, 4000d, marker);
markerDetector.MarkersDetected += (obj, args) =>
{
Dispatcher.BeginInvoke(() =>
{
var results = args.DetectionResults;
if (results.HasResults)
{
var centerAtOrigin =
Matrix3DFactory.
CreateTranslation(
-Imagem.ActualWidth*
0.5,
-Imagem.
ActualHeight*
0.5, 0);
var scale =
Matrix3DFactory.CreateScale
(0.5, -0.5, 0.5);
var world = centerAtOrigin*
scale*
results[0].
Transformation;
var vp =
Matrix3DFactory.
CreateViewportTransformation
(Viewport.ActualWidth,
Viewport.ActualHeight);
var m =
Matrix3DFactory.
CreateViewportProjection
(world,
Matrix3D.Identity,
markerDetector.
Projection, vp);
Imagem.Projection =
new Matrix3DProjection
{ProjectionMatrix = m};
}
});
};
}
示例9: CaptureImage
/// <summary>
/// captures images at specified time intervals
/// </summary>
/// <param name="vb">a videobrush object for the camera</param>
/// <param name="samplingFrequency">time between image captures(in minutes)</param>
/// <param name="count">number of times images are to be captured</param>
public void CaptureImage(VideoBrush vb,int samplingFrequency, int count)
{
this.count=count;
source = new EventSource(samplingFrequency, 0);
source.OnEvent += new EventSource.TickEventHandler(Source_OnEvent);
source.Start();
source.OffEvent += new EventSource.TickEventHandler(Source_OffEvent);
InitializeCamera(vb);
}
示例10: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Tutorial16%20-%20Multiple%20Viewport%20-%20Phone;component/GamePage.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.viewfinderBrush = ((System.Windows.Media.VideoBrush)(this.FindName("viewfinderBrush")));
}
示例11: NullSource
public void NullSource ()
{
VideoBrush vb = new VideoBrush ();
Assert.Throws<NullReferenceException> (delegate {
vb.SetSource ((MediaElement) null);
}, "MediaElement");
Assert.Throws<NullReferenceException> (delegate {
vb.SetSource ((CaptureSource) null);
}, "CaptureSource");
}
示例12: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/com.ninki.wallet;component/Plugins/com.phonegap.plugins.barcodescanner/BarcodeSc" +
"annerUI.xaml", System.UriKind.Relative));
this.CameraCanvas = ((System.Windows.Controls.Canvas)(this.FindName("CameraCanvas")));
this.CameraBrush = ((System.Windows.Media.VideoBrush)(this.FindName("CameraBrush")));
}
示例13: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/LocalD;component/Pages/CameraPage.xaml", System.UriKind.Relative));
this.CameraViewbox = ((System.Windows.Controls.Viewbox)(this.FindName("CameraViewbox")));
this.ViewfinderCanvas = ((System.Windows.Controls.Canvas)(this.FindName("ViewfinderCanvas")));
this.ViewfinderBrush = ((System.Windows.Media.VideoBrush)(this.FindName("ViewfinderBrush")));
}
示例14: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/TaskyWinPhone;component/PageCam.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.viewfinderCanvas = ((System.Windows.Controls.Canvas)(this.FindName("viewfinderCanvas")));
this.viewfinderBrush = ((System.Windows.Media.VideoBrush)(this.FindName("viewfinderBrush")));
}
示例15: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Tutorial8%20-%20Optical%20Marker%20Tracking%20-%20Silverlight;component/GamePage" +
".xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.viewfinderBrush = ((System.Windows.Media.VideoBrush)(this.FindName("viewfinderBrush")));
}