本文整理汇总了C#中Microsoft.SPOT.Bitmap.StretchImage方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.StretchImage方法的具体用法?C# Bitmap.StretchImage怎么用?C# Bitmap.StretchImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SPOT.Bitmap
的用法示例。
在下文中一共展示了Bitmap.StretchImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderRectangle
protected internal override void RenderRectangle(Bitmap bmp, Pen pen, int x, int y, int width, int height, int xCornerRadius, int yCornerRadius)
{
if (Stretch == Stretch.None)
bmp.DrawImage(x, y, BitmapSource, 0, 0, BitmapSource.Width, BitmapSource.Height, Opacity);
else if (width == BitmapSource.Width && height == BitmapSource.Height)
bmp.DrawImage(x, y, BitmapSource, 0, 0, width, height, Opacity);
else
bmp.StretchImage(x, y, BitmapSource, width, height, Opacity);
if (pen != null && pen.Thickness > 0)
bmp.DrawRectangle((MSMedia.Color)pen.Color, pen.Thickness, x, y, width, height, xCornerRadius, yCornerRadius, (MSMedia.Color)0, 0, 0, (MSMedia.Color)0, 0, 0, 0);
}
示例2: Main
public static void Main()
{
int screenWidth, screenHeight, bitsPerPixel, orientationDeg;
HardwareProvider.HwProvider.GetLCDMetrics(out screenWidth, out screenHeight,
out bitsPerPixel, out orientationDeg);
Bitmap bmp = new Bitmap(screenWidth, screenHeight);
Bitmap soccerBall = Resources.GetBitmap(Resources.BitmapResources.SoccerBall);
bmp.StretchImage(100, 50, // destination coordinates
soccerBall, // source image
soccerBall.Width / 2, // half width
soccerBall.Height * 2, // double height
Bitmap.OpacityOpaque); // opacity
bmp.Flush();
Thread.Sleep(-1); //do not terminate app to see result
}
示例3: Run
public override void Run()
{
try
{
using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
{
var bitmaps = new[]
{
Resources.BitmapResources.out0,
Resources.BitmapResources.out1,
Resources.BitmapResources.out2
};
for (int i = 0; i < bitmaps.Length; i++)
{
using (Bitmap src = Resources.GetBitmap(bitmaps[i]))
{
for (int s = 0; ; s += 3)
{
int w = s * Dimensions.Width / 200;
int h = s * Dimensions.Height / 200;
if (w > (Dimensions.Width) && h > (Dimensions.Height))
break;
int x = (Dimensions.Width - w) / 2;
int y = (Dimensions.Height - h) / 2;
bmp.StretchImage(x, y, src, w, h, 256);
bmp.Flush();
}
}
Thread.Sleep(1000);
}
}
Pass = true;
}
catch (Exception e)
{
UnexpectedException(e);
}
}
示例4: StretchImage
public void StretchImage(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap, int xSrc, int ySrc, int widthSrc, int heightSrc, ushort opacity)
{
bitmap.StretchImage(translationX + xDst, translationY + yDst, widthDst, heightDst, bitmap, xSrc, ySrc, widthSrc, heightSrc, opacity);
}
示例5: OnTouchGestureChanged
/// <summary>
/// Handles multi-touch gesture events. Multitouch gestures are performed on the emulator by
/// holding down CTRL+[Z|P|R] and inking (to change the angle/zoom level).
/// </summary>
/// <param name="e">Touch gesture event data</param>
protected override void OnTouchGestureChanged(TouchGestureEventArgs e)
{
base.OnTouchGestureChanged(e);
Bitmap b;
switch (e.Gesture)
{
///
/// Zoom gesture magnifies the original bitmap by the gesture value contained in e.Arguments
///
case TouchGesture.Zoom:
if (_bmpGesture != null)
{
b = new Bitmap(_bitmap.Width, _bitmap.Height);
b.DrawRectangle(Color.Black, 1, 0, 0, b.Width - 2, b.Height - 2, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
b.StretchImage(-(e.Arguments), -(e.Arguments), _bmpGesture, _bmpGesture.Width + 2 * (e.Arguments), _bmpGesture.Height + 2 * (e.Arguments), Bitmap.OpacityOpaque);
_bitmap = b;
Invalidate();
}
break;
///
/// Pan (zoom out) gesture shrinks the original bitmap by the gesture value contained in e.Arguments
///
case TouchGesture.Pan:
if (_bmpGesture != null)
{
b = new Bitmap(_bitmap.Width, _bitmap.Height);
b.DrawRectangle(Color.Black, 1, 0, 0, b.Width - 2, b.Height - 2, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
b.StretchImage((e.Arguments), (e.Arguments), _bmpGesture, _bmpGesture.Width - 2 * (e.Arguments), _bmpGesture.Height - 2 * (e.Arguments), Bitmap.OpacityOpaque);
_bitmap = b;
Invalidate();
}
break;
///
/// Rotate gesture spins the original bitmap by the gesture value contained in e.Angle (0-360).
///
case TouchGesture.Rotate:
if (_bmpGesture != null)
{
b = new Bitmap(_bitmap.Width, _bitmap.Height);
b.DrawRectangle(Color.Black, 1, 0, 0, b.Width, b.Height, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
b.RotateImage((int)e.Angle, 1, 1, _bmpGesture, 1, 1, _bmpGesture.Width - 2, _bmpGesture.Height - 2, Bitmap.OpacityOpaque);
_bitmap = b;
Invalidate();
}
break;
}
}
示例6: Run
public override void Run()
{
try
{
Bitmap bmp = new Bitmap( Dimensions.Width, Dimensions.Height );
Resources.BitmapResources[] bitmaps = new Resources.BitmapResources[]
{
Resources.BitmapResources.Outlook0,
Resources.BitmapResources.Outlook1,
Resources.BitmapResources.Outlook2,
};
for(int i = 0; i < bitmaps.Length; i++ )
{
Bitmap src = Resources.GetBitmap( bitmaps[i] );
for(int s = 0; s <= 800; s++)
{
int w = s * Dimensions.Width / 200;
int h = s * Dimensions.Height / 200;
int x = (Dimensions.Width - w) / 2;
int y = (Dimensions.Height - h) / 2;
bmp.StretchImage( x, y, src, w, h, 256 );
bmp.Flush();
}
Thread.Sleep( 3000 );
}
Pass = true;
}
catch (Exception e)
{
UnexpectedException( e );
}
}