WriteableBitmap writeableBmp =
new
WriteableBitmap(512, 512);
ImageControl.Source = writeableBmp;
writeableBmp =
new
WriteableBitmap(0, 0).FromResource(
"Data/flower2.png"
);
writeableBmp.Clear(Colors.White);
writeableBmp.SetPixel(10, 13, Colors.Black);
Color color = writeableBmp.GetPixel(30, 43);
writeableBmp.DrawLine(1, 2, 30, 40, Colors.Green);
int
[] pixels = writeableBmp.Pixels;
int
w = writeableBmp.PixelWidth;
int
h = writeableBmp.PixelHeight;
WriteableBitmapExtensions.DrawLine(pixels, w, h, 1, 2, 30, 40, myIntColor);
writeableBmp.DrawTriangle(10, 5, 20, 40, 30, 10, Colors.Black);
writeableBmp.DrawRectangle(2, 4, 12, 10, Colors.Red);
writeableBmp.FillEllipseCentered(2, 2, 8, 5, Colors.Blue);
int
[] p =
new
int
[] { 10, 5, 20, 40, 30, 30, 7, 8, 10, 5 };
writeableBmp.DrawPolyline(p, Colors.Green);
writeableBmp.DrawBezier(5, 5, 10, 15, 15, 0, 20, 7, Colors.Purple);
int
[] pts =
new
int
[] { 10, 5, 20, 40, 30, 30};
writeableBmp.DrawCurve(pts, 0.5, Colors.Yellow);
writeableBmp.FillCurveClosed(pts, 0.5, Colors.Green);
writeableBmp.Blit(
new
Point(10, 10), bitmap, sourceRect, Colors.White,
WriteableBitmapExtensions.BlendMode.Additive);
writeableBmp.ForEach((x, y, color) => Color.FromArgb(color.A, (
byte
)(color.R / 2),
(
byte
)(x * y), 100));
writeableBmp.Invalidate();
var
clone = writeableBmp.Clone();
writeableBmp.WriteTga(stream);
var
cropped = writeableBmp.Crop(5, 8, 10, 10);
var
resized = writeableBmp.Resize(200, 300,
WriteableBitmapExtensions.Interpolation.Bilinear);