本文整理汇总了C#中ImageSource.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# ImageSource.Freeze方法的具体用法?C# ImageSource.Freeze怎么用?C# ImageSource.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageSource
的用法示例。
在下文中一共展示了ImageSource.Freeze方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Manager
private Manager()
{
#region Creates Loading Threads
_loaderThreadForThumbnails = new Thread(new ThreadStart(LoaderThreadThumbnails));
_loaderThreadForThumbnails.IsBackground = true; // otherwise, the app won't quit with the UI...
_loaderThreadForThumbnails.Priority = ThreadPriority.BelowNormal;
_loaderThreadForThumbnails.Start();
_loaderThreadForNormalSize = new Thread(new ThreadStart(LoaderThreadNormalSize));
_loaderThreadForNormalSize.IsBackground = true; // otherwise, the app won't quit with the UI...
_loaderThreadForNormalSize.Priority = ThreadPriority.BelowNormal;
_loaderThreadForNormalSize.Start();
#endregion
#region Loading Images from Resources
ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionary.Source = new Uri("WordsLive;component/Utils/ImageLoader/Resources.xaml", UriKind.Relative);
_loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
_loadingImage.Freeze();
_errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
_errorThumbnail.Freeze();
#endregion
# region Create Loading Animation
ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
SkewTransform skewTransform = new SkewTransform(0, 0);
RotateTransform rotateTransform = new RotateTransform(0);
TranslateTransform translateTransform = new TranslateTransform(0, 0);
TransformGroup group = new TransformGroup();
group.Children.Add(scaleTransform);
group.Children.Add(skewTransform);
group.Children.Add(rotateTransform);
group.Children.Add(translateTransform);
DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);
_loadingAnimationTransform = group;
#endregion
}
示例2: ShadowWindow
static ShadowWindow()
{
//加载阴影图片
ActiveTopLeftImage = new BitmapImage(GetImageUri("ACTIVESHADOWTOPLEFT.png"));
ActiveTopImage = new BitmapImage(GetImageUri("ACTIVESHADOWTOP.png"));
ActiveTopRightImage = new BitmapImage(GetImageUri("ACTIVESHADOWTOPRIGHT.png"));
ActiveLeftImage = new BitmapImage(GetImageUri("ACTIVESHADOWLEFT.png"));
ActiveRightImage = new BitmapImage(GetImageUri("ACTIVESHADOWRIGHT.png"));
ActiveBottomLeftImage = new BitmapImage(GetImageUri("ACTIVESHADOWBOTTOMLEFT.png"));
ActiveBottomImage = new BitmapImage(GetImageUri("ACTIVESHADOWBOTTOM.png"));
ActiveBottomRightImage = new BitmapImage(GetImageUri("ACTIVESHADOWBOTTOMRIGHT.png"));
InactiveTopLeftImage = new BitmapImage(GetImageUri("INACTIVESHADOWTOPLEFT.png"));
InactiveTopImage = new BitmapImage(GetImageUri("INACTIVESHADOWTOP.png"));
InactiveTopRightImage = new BitmapImage(GetImageUri("INACTIVESHADOWTOPRIGHT.png"));
InactiveLeftImage = new BitmapImage(GetImageUri("INACTIVESHADOWLEFT.png"));
InactiveRightImage = new BitmapImage(GetImageUri("INACTIVESHADOWRIGHT.png"));
InactiveBottomLeftImage = new BitmapImage(GetImageUri("INACTIVESHADOWBOTTOMLEFT.png"));
InactiveBottomImage = new BitmapImage(GetImageUri("INACTIVESHADOWBOTTOM.png"));
InactiveBottomRightImage = new BitmapImage(GetImageUri("INACTIVESHADOWBOTTOMRIGHT.png"));
//冻结阴影图像,以便图像重复使用
ActiveTopLeftImage.Freeze();
ActiveTopImage.Freeze();
ActiveTopRightImage.Freeze();
ActiveLeftImage.Freeze();
ActiveRightImage.Freeze();
ActiveBottomLeftImage.Freeze();
ActiveBottomImage.Freeze();
ActiveBottomRightImage.Freeze();
InactiveTopLeftImage.Freeze();
InactiveTopImage.Freeze();
InactiveTopRightImage.Freeze();
InactiveLeftImage.Freeze();
InactiveRightImage.Freeze();
InactiveBottomLeftImage.Freeze();
InactiveBottomImage.Freeze();
InactiveBottomRightImage.Freeze();
}
示例3: SetBackgroundColor
void SetBackgroundColor(ImageSource img)
{
if (img != null)
{
img.Freeze();
if (backgroundcolor_THREAD != null) backgroundcolor_THREAD.Abort();
backgroundcolor_THREAD = new Thread(new ParameterizedThreadStart(SetBackgroundColor_Worker));
backgroundcolor_THREAD.Start(img);
}
}
示例4: initialize
private void initialize(int sensorIdx)
{
Enabled = true;
cameraService = SpringUtil.getService<ICameraService>();
sensorService = SpringUtil.getService<ISensorService>();
skeletonService = SpringUtil.getService<ISkeletonService>();
gestureService = SpringUtil.getService<IGestureService>();
sensorService.startSensor(sensorIdx);
cameraService.startCameraService(sensorService.getSensor(sensorIdx));
skeletonService.enableSkeleton(sensorService.getSensor(sensorIdx));
gestureService.enableGestureService(sensorService.getSensor(sensorIdx));
imgHandLeft = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT));
imgHandRight = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT));
imgHandLeftActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_LEFT_ACTIVE));
imgHandRightActive = new BitmapImage(new Uri(Application.Current.StartupUri, IMAGE_HAND_RIGHT_ACTIVE));
imgHandLeft.Freeze();
imgHandRight.Freeze();
imgHandLeftActive.Freeze();
imgHandRightActive.Freeze();
}
示例5: SetBackgroundColor
void SetBackgroundColor(ImageSource img)
{
if (img != null)
{
img.Freeze();
ThreadPool.QueueUserWorkItem(new WaitCallback(SetBackgroundColor_Worker), img);
}
}
示例6: SetColor
/// <summary>
/// Setta il colore usato dall'evidenziatore.
/// </summary>
private static void SetColor()
{
// Create the pen and brush to color the box behind the a's
Brush myBrush = null;
if (AlmaStyleFixPackage.Page == null)
{
myBrush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));
}
else
{
myBrush = new SolidColorBrush(Color.FromArgb(
Convert.ToByte(AlmaStyleFixPackage.Page.A),
Convert.ToByte(AlmaStyleFixPackage.Page.R),
Convert.ToByte(AlmaStyleFixPackage.Page.G),
Convert.ToByte(AlmaStyleFixPackage.Page.B)));
}
// myBrush.Freeze();
Brush penBrush = new SolidColorBrush(Colors.Red);
penBrush.Freeze();
Pen myPen = new Pen(penBrush, 0.5);
myPen.Freeze();
// draw a square with the created brush and pen
System.Windows.Rect r = new System.Windows.Rect(0, 0, 5, 5);
Geometry g = new RectangleGeometry(r);
GeometryDrawing drawing = new GeometryDrawing(myBrush, myPen, g);
drawing.Freeze();
image = new DrawingImage(drawing);
image.Freeze();
}