本文整理汇总了C#中System.Windows.Media.Imaging.WriteableBitmap.FillRectangleDeBlend方法的典型用法代码示例。如果您正苦于以下问题:C# WriteableBitmap.FillRectangleDeBlend方法的具体用法?C# WriteableBitmap.FillRectangleDeBlend怎么用?C# WriteableBitmap.FillRectangleDeBlend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Imaging.WriteableBitmap
的用法示例。
在下文中一共展示了WriteableBitmap.FillRectangleDeBlend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGrid
//.........这里部分代码省略.........
if (_overlayImage == null)
{
BitmapImage bitmapSource = new BitmapImage();
bitmapSource.DecodePixelWidth = writeableBitmap.PixelWidth;
bitmapSource.BeginInit();
bitmapSource.UriSource = new Uri(OverlayUseLastCaptured ? _lastOverlay : SelectedOverlay);
bitmapSource.EndInit();
_overlayImage = BitmapFactory.ConvertToPbgra32Format(bitmapSource);
_overlayImage.Freeze();
}
int x = writeableBitmap.PixelWidth*OverlayScale/100;
int y = writeableBitmap.PixelHeight*OverlayScale/100;
int xx = writeableBitmap.PixelWidth*OverlayHorizontal/100;
int yy = writeableBitmap.PixelWidth*OverlayVertical/100;
System.Windows.Media.Color transpColor = Colors.White;
//set color transparency for blit only the alpha chanel is used from transpColor
if (OverlayTransparency < 100)
transpColor = System.Windows.Media.Color.FromArgb((byte) (0xff*OverlayTransparency/100d), 0xff, 0xff, 0xff);
writeableBitmap.Blit(
new Rect(0 + (x / 2) + xx, 0 + (y / 2) + yy, writeableBitmap.PixelWidth - x,
writeableBitmap.PixelHeight - y),
_overlayImage,
new Rect(0, 0, _overlayImage.PixelWidth, _overlayImage.PixelHeight), transpColor,
WriteableBitmapExtensions.BlendMode.Alpha);
}
}
switch (GridType)
{
case 1:
{
for (int i = 1; i < 3; i++)
{
writeableBitmap.DrawLine(0, (int)((writeableBitmap.Height / 3) * i),
(int)writeableBitmap.Width,
(int)((writeableBitmap.Height / 3) * i), color);
writeableBitmap.DrawLine((int)((writeableBitmap.Width / 3) * i), 0,
(int)((writeableBitmap.Width / 3) * i),
(int)writeableBitmap.Height, color);
}
writeableBitmap.SetPixel((int)(writeableBitmap.Width / 2), (int)(writeableBitmap.Height / 2), 128,
Colors.Red);
}
break;
case 2:
{
for (int i = 1; i < 10; i++)
{
writeableBitmap.DrawLine(0, (int)((writeableBitmap.Height / 10) * i),
(int)writeableBitmap.Width,
(int)((writeableBitmap.Height / 10) * i), color);
writeableBitmap.DrawLine((int)((writeableBitmap.Width / 10) * i), 0,
(int)((writeableBitmap.Width / 10) * i),
(int)writeableBitmap.Height, color);
}
writeableBitmap.SetPixel((int)(writeableBitmap.Width / 2), (int)(writeableBitmap.Height / 2), 128,
Colors.Red);
}
break;
case 3:
{
writeableBitmap.DrawLineDDA(0, 0, (int)writeableBitmap.Width,
(int)writeableBitmap.Height, color);
writeableBitmap.DrawLineDDA(0, (int)writeableBitmap.Height,
(int)writeableBitmap.Width, 0, color);
writeableBitmap.SetPixel((int)(writeableBitmap.Width / 2), (int)(writeableBitmap.Height / 2), 128,
Colors.Red);
}
break;
case 4:
{
writeableBitmap.DrawLineDDA(0, (int)(writeableBitmap.Height / 2), (int)writeableBitmap.Width,
(int)(writeableBitmap.Height / 2), color);
writeableBitmap.DrawLineDDA((int)(writeableBitmap.Width / 2), 0,
(int)(writeableBitmap.Width / 2), (int)writeableBitmap.Height, color);
writeableBitmap.SetPixel((int)(writeableBitmap.Width / 2), (int)(writeableBitmap.Height / 2), 128,
Colors.Red);
}
break;
default:
break;
}
if (ShowRuler && NoSettingArea)
{
int x1 = writeableBitmap.PixelWidth * (HorizontalMin) / 1000;
int x2 = writeableBitmap.PixelWidth * (HorizontalMin+HorizontalMax) / 1000;
int y2 = writeableBitmap.PixelHeight * (VerticalMin+VerticalMax) / 1000;
int y1 = writeableBitmap.PixelHeight * VerticalMin / 1000;
writeableBitmap.FillRectangle2(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, System.Windows.Media.Color.FromArgb(128, 128, 128, 128));
writeableBitmap.FillRectangleDeBlend(x1, y1, x2, y2, System.Windows.Media.Color.FromArgb(128, 128, 128, 128));
writeableBitmap.DrawRectangle(x1, y1, x2, y2, color);
}
}
示例2: DrawGrid
private void DrawGrid(WriteableBitmap writeableBitmap)
{
Color color = Colors.White;
color.A = 50;
if (ShowRuler && NoSettingArea)
{
int x1 = writeableBitmap.PixelWidth * (HorizontalMin) / 1000;
int x2 = writeableBitmap.PixelWidth * (HorizontalMin + HorizontalMax) / 1000;
int y2 = writeableBitmap.PixelHeight * (VerticalMin + VerticalMax) / 1000;
int y1 = writeableBitmap.PixelHeight * VerticalMin / 1000;
writeableBitmap.FillRectangle2(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, Color.FromArgb(128, 128, 128, 128));
writeableBitmap.FillRectangleDeBlend(x1, y1, x2, y2, Color.FromArgb(128, 128, 128, 128));
writeableBitmap.DrawRectangle(x1, y1, x2, y2, color);
}
}