本文整理汇总了C#中Microsoft.SPOT.Bitmap类的典型用法代码示例。如果您正苦于以下问题:C# Bitmap类的具体用法?C# Bitmap怎么用?C# Bitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bitmap类属于Microsoft.SPOT命名空间,在下文中一共展示了Bitmap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
//private Bitmap img = new Bitmap(Resources.GetBytes(Resources.BinaryResources.AnalogTicksOutside),
// Bitmap.BitmapImageType.Gif);
//private Bitmap img = new Bitmap(Resources.GetBytes(Resources.BinaryResources.AnalogTicksInside),
// Bitmap.BitmapImageType.Gif);
public override void Render(Bitmap screen)
{
if (_screen == null) _screen = screen;
screen.DrawImage(0, 0, img, 0, 0, img.Width, img.Height);
var text = "AGENT";
Point textLocation = new Point(
AGENT.Center.X - (drawing.MeasureString(text, smallFont) / 2), AGENT.Center.Y - 25);
screen.DrawText(text, smallFont, Color.White, textLocation.X, textLocation.Y);
var date = Settings.Now.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.MonthDayPattern);
; //time.MonthNameShort + " " + time.Day;
Point dateLocation = new Point(
AGENT.Center.X - (drawing.MeasureString(date, smallFont) / 2), AGENT.Center.Y + 20);
screen.DrawText(date, smallFont, Color.White, dateLocation.X, dateLocation.Y);
//draw our hands
drawing.PaintSkinnyHands(screen, Settings.Now, AGENT.Center);
drawing.DrawTray(screen, _notificationProvider, smallFont);
}
示例2: Run
public override void Run()
{
try
{
using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
{
bmp.DrawLine(Colors.Red, 1,
Dimensions.Width/2, Dimensions.Height/2,
Dimensions.Width, Dimensions.Height/2);
bmp.DrawLine(Colors.Green, 1,
Dimensions.Width/2, Dimensions.Height/2,
Dimensions.Width/2, 0);
bmp.Flush();
}
Thread.Sleep(3000);
Pass = true;
}
catch (Exception e)
{
UnexpectedException(e);
}
}
示例3: Main
public static void Main()
{
_display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight);
currentTime = new DateTime();
_azmdrawing = new AZMDrawing();
_point = new AGENT.AZMutil.Point();
colorBackground = Color.Black;
colorForeground = Color.White;
UpdateTime(null);
currentTime = DateTime.Now;
dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond);
period = new TimeSpan(0, 0, 1, 0, 0);
_updateClockTimer = new Timer(UpdateTime, null, dueTime, period); // start our update timer
ButtonHelper.Current.OnButtonPress += Current_OnButtonPress;
Thread.Sleep(Timeout.Infinite);
}
示例4: Program
private Program()
{
OneTimeConfig();
_lcd = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
Touch.Initialize(this);
this.MainWindow = new Window();
this.MainWindow.TouchDown += MainWindow_TouchDown;
this.MainWindow.TouchUp += MainWindow_TouchUp;
this.MainWindow.TouchMove += MainWindow_TouchMove;
var eth = new EthernetBuiltIn();
eth.Open();
if (!eth.CableConnected)
{
eth.Close();
var wifi = new WiFiRS9110(SPI.SPI_module.SPI1, G400.PD13, G400.PD12, G400.PD15);
_netif = wifi;
_netif.Open();
wifi.Join("XXX", "XXX");
}
else
{
_netif = eth;
}
if (!_netif.IsDhcpEnabled)
_netif.EnableDhcp();
if (!_netif.IsDynamicDnsEnabled)
_netif.EnableDynamicDns();
NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
}
示例5: GraphicsManager
public GraphicsManager(int width, int height)
{
//mouseManager = new MouseManager(canvas);
//mouseManager.OnMouseDblClick = InterceptMouseDblClick;
//mouseManager.OnMouseDown = InterceptMouseDown;
//mouseManager.OnMouseUp = InterceptMouseUp;
//mouseManager.OnMouseMove = InterceptMouseMove;
//mouseManager.OnMouseOut = InterceptMouseOut;
TouchManager.TouchDown += new TouchEventHandler(TouchManager_TouchDown);
TouchManager.TouchMove += new TouchEventHandler(TouchManager_TouchMove);
TouchManager.TouchUp += new TouchEventHandler(TouchManager_TouchUp);
TouchManager.TouchGestureStarted += new TouchGestureEventHandler(TouchManager_TouchGestureStarted);
TouchManager.TouchGestureChanged += new TouchGestureEventHandler(TouchManager_TouchGestureChanged);
TouchManager.TouchGestureEnded += new TouchGestureEventHandler(TouchManager_TouchGestureEnded);
TouchManager.Initialize();
bitmap = new Bitmap(width, height);
desktop = new Desktop(width, height, this);
cw = new CalibrationWindow(width, height, this)
{
Background = new SolidColorBrush(Color.CornflowerBlue),
CrosshairPen = new Pen(Color.Red, 1)
};
if (CalibrationManager.IsCalibrated)
CalibrationManager.ApplyCalibrationPoints();
desktop.Invalidate();
}
示例6: Render
public void Render(Bitmap screen, bool military, ArrayList forecast)
{
DateTime now = DateTime.Now;
string display = "";
string hour, minute = now.Minute.ToString();
if (military)
{
hour = now.Hour.ToString();
}
else
{
int h = now.Hour;
if (h >= 12) h = h - 12;
if (h == 0) h = 12;
hour = h.ToString();
}
if (minute.Length == 1) minute = "0" + minute;
display = hour + ":" + minute;
screen.DrawLine(Color.White, 2, 0, Program.AgentSize/2, Program.AgentSize, Program.AgentSize/2);
int left = Program.AgentSize - Program.MeasureString(display, bigfont);
screen.DrawText(display, bigfont, Color.White, left, (Program.AgentSize/2) +2);
string dow = System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames[(int) now.DayOfWeek];
screen.DrawText(dow.ToString(), font, Color.White, 5, 10);
string date = System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthNames[(int) now.Month];
date = date + " " + now.Day.ToString();
screen.DrawText(date, font, Color.White, 5, 30);
}
示例7: SetBootLogo
public static bool SetBootLogo(Bitmap logo, int x, int y)
{
if (Utils.IsEmulator)
return false;
if (logo != null)
{
// New settings were saved, must reboot
// The start-up logo will take effect after the first reset
bool res = Configuration.StartUpLogo.Set(logo.GetBitmap(), x, y);
Thread.Sleep(1000); // to set logo bitmap
Configuration.StartUpLogo.Enabled = true;
return res;
//return Configuration.StartUpLogo.Set(logo.GetBitmap(), (int)(ScreenWidth - logo.Width) / 2, (int)(ScreenHeight - logo.Height) / 2);
}
else
{
if (Configuration.StartUpLogo.Enabled)
{
Configuration.StartUpLogo.Enabled = false;
return true;
}
else
return false;
}
}
示例8: Run
public override void Run()
{
using (var bitmap = new Bitmap(Dimensions.Width, Dimensions.Height))
{
using (var img = Resources.GetBitmap(Resources.BitmapResources.compass2))
{
int da = 3;
for (int angle = 0; angle <= 360 && angle >= 0; angle += da)
{
bitmap.DrawRectangle(Colors.White, 0, 0, 0,
Dimensions.Width, Dimensions.Height,
0, 0, Colors.White, 0, 0, Colors.White, 0, 0,
Bitmap.OpacityOpaque);
int xdst = (Dimensions.Width - img.Width)/2,
ydst = (Dimensions.Height - img.Height)/2;
bitmap.RotateImage(angle, xdst, ydst, img, 0, 0, img.Width, img.Height, 0x00);
bitmap.Flush();
if (angle > 180)
da = -da;
}
}
}
}
示例9: Run
public override void Run()
{
try
{
using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
{
var rand = new Random();
for (int i = 0; i < 100; i++)
{
var fillColor = (Color)rand.Next(0xFFFFFF);
bmp.DrawRectangle((Color) rand.Next(0xFFFFFF), rand.Next(1),
rand.Next(Dimensions.Width), rand.Next(Dimensions.Height),
rand.Next(Dimensions.Width), rand.Next(Dimensions.Height),
0, 0, fillColor, 0, 0, fillColor, 0, 0, (ushort) rand.Next(256));
bmp.Flush();
}
}
Pass = true;
}
catch (Exception e)
{
UnexpectedException(e);
}
}
示例10: camera_BitmapStreamed
void camera_BitmapStreamed(GTM.GHIElectronics.Camera sender, Bitmap bitmap)
{
//320*240
displayT35.SimpleGraphics.DisplayImage(bitmap, 0, 0);
detectionMove(bitmap);
}
示例11: RenderRectangle
protected internal override void RenderRectangle(Bitmap bmp, Pen pen, int x, int y, int width, int height)
{
Color outlineColor = (pen != null) ? pen.Color : (Color)0x0;
ushort outlineThickness = (pen != null) ? pen.Thickness : (ushort)0;
int x1, y1;
int x2, y2;
switch (MappingMode)
{
case BrushMappingMode.RelativeToBoundingBox:
x1 = x + (int)((long)(width - 1) * StartX / RelativeBoundingBoxSize);
y1 = y + (int)((long)(height - 1) * StartY / RelativeBoundingBoxSize);
x2 = x + (int)((long)(width - 1) * EndX / RelativeBoundingBoxSize);
y2 = y + (int)((long)(height - 1) * EndY / RelativeBoundingBoxSize);
break;
default: //case BrushMappingMode.Absolute:
x1 = StartX;
y1 = StartY;
x2 = EndX;
y2 = EndY;
break;
}
bmp.DrawRectangle((MSMedia.Color)outlineColor, outlineThickness, x, y, width, height, 0, 0, (MSMedia.Color)StartColor, x1, y1, (MSMedia.Color)EndColor, x2, y2, Opacity);
}
示例12: TinyBitmap
/// <summary>
/// Constructs a TinyBitmap from a preexisting bitmap.
/// </summary>
/// <param name="bitmap">The bitmap to construct from.</param>
public TinyBitmap(Bitmap bitmap)
{
this.Width = (uint)bitmap.Width;
this.Height = (uint)bitmap.Height;
this.Data = new byte[this.Width * this.Height * 2];
Util.BitmapConvertBPP(bitmap.GetBitmap(), this.Data, Util.BPP_Type.BPP16_BGR_BE);
}
示例13: Run
public override void Run()
{
try
{
using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
{
var bitmaps = new[]
{
Resources.BitmapResources.cat2,
Resources.BitmapResources.cat1,
Resources.BitmapResources.cat3
};
for (int i = 0; i < bitmaps.Length; i++)
{
using (Bitmap src = Resources.GetBitmap(bitmaps[i]))
bmp.DrawImage(0, 0, src, 0, 0, src.Width, src.Height);
bmp.Flush();
Thread.Sleep(2000);
}
}
Pass = true;
}
catch (Exception e)
{
UnexpectedException(e);
}
}
示例14: Run
public override void Run()
{
try
{
using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
{
const string text = "Hello World";
int textWidth, textHeight;
Font font = Resources.GetFont(Resources.FontResources.ninabd18ppem);
font.ComputeExtent(text, out textWidth, out textHeight);
int textX = (Dimensions.Width - textWidth)/2;
var rand = new Random();
for (int x = 0; x < 3; x++)
{
int baseColor = rand.Next(0xffff);
for (int i = 0; i < Dimensions.Height; i++)
{
bmp.Clear();
bmp.DrawText(text, font, (Color) (((255 - i) << 16) | baseColor), textX, i);
bmp.Flush();
}
}
}
Pass = true;
}
catch (Exception e)
{
UnexpectedException(e);
}
}
示例15: ChangeBitmapColor
public static void ChangeBitmapColor(Bitmap img, Color anyDifferentColor, Color changeTo)
{
for (int x = 0; x < img.Width; x++)
for (int y = 0; y < img.Height; y++)
if (img.GetPixel(x, y) != anyDifferentColor)
img.SetPixel(x, y, changeTo);
}