本文整理汇总了C#中Microsoft.SPOT.Bitmap类的典型用法代码示例。如果您正苦于以下问题:C# Bitmap类的具体用法?C# Bitmap怎么用?C# Bitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bitmap类属于Microsoft.SPOT命名空间,在下文中一共展示了Bitmap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:nicksi,项目名称:AGENT.Contrib,代码行数:32,代码来源:AnalogFace.cs
示例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);
}
}
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:25,代码来源:Orientation.cs
示例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);
}
开发者ID:Tamegoro,项目名称:AGENT,代码行数:25,代码来源:Eyes.cs
示例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;
}
开发者ID:VerdantAutomation,项目名称:VerdantHub,代码行数:34,代码来源:Program.cs
示例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();
}
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:30,代码来源:GraphicsManager.cs
示例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);
}
开发者ID:nothingmn,项目名称:Agent.TripleFace,代码行数:32,代码来源:WatchFace.cs
示例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;
}
}
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:27,代码来源:LCDManager.cs
示例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;
}
}
}
}
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:26,代码来源:Rotate.cs
示例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);
}
}
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:25,代码来源:RandomDrawRectangle.cs
示例10: camera_BitmapStreamed
void camera_BitmapStreamed(GTM.GHIElectronics.Camera sender, Bitmap bitmap)
{
//320*240
displayT35.SimpleGraphics.DisplayImage(bitmap, 0, 0);
detectionMove(bitmap);
}
开发者ID:OscarHMG,项目名称:ProyectoCameraSecurity,代码行数:7,代码来源:Program.cs
示例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);
}
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:26,代码来源:LinearGradientBrush.cs
示例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);
}
开发者ID:errolt,项目名称:NETMF4.3_Community,代码行数:11,代码来源:TinyBitmap.cs
示例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);
}
}
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:30,代码来源:SlideShow.cs
示例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);
}
}
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:33,代码来源:DrawTextTest.cs
示例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);
}
开发者ID:andrei-tatar,项目名称:MediaPlayer.NETMF,代码行数:7,代码来源:Utils.cs
示例16: Render
public void Render(Bitmap screen)
{
if (_screen == null) _screen = screen;
_screen.DrawLine(Color.White, 2, 0, AGENT.Contrib.Device.Size / 2, AGENT.Contrib.Device.Size, AGENT.Contrib.Device.Size / 2);
DateTime now = DateTime.Now;
int counter = (int) now.DayOfWeek;
counter++;
int left = buffer;
for (int x = 0; x <= days; x++)
{
if (counter >= 7) counter = 0;
string dayName = System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames[counter];
if (dayName.Length >= 3) dayName = dayName.Substring(0, 3);
int width = drawing.MeasureString(dayName, font);
_screen.DrawText(dayName, font, Color.White, left, top);
IForecast current = CurrentConditions.CurrentWeekForecast[x] as IForecast;
_screen.DrawText(current.Temperature.ToString(), font, Color.White, left + 4, top + font.Height + 2);
counter++;
if (counter > 6) counter = 0;
left += width + buffer;
}
string display = CurrentConditions.CurrentForecast.Temperature.ToString();
int forecastLeft = AGENT.Contrib.Device.Size - drawing.MeasureString(display, bigfont);
_screen.DrawText(display, bigfont, Color.White, forecastLeft, (AGENT.Contrib.Device.Size/2) + 2);
_screen.DrawText(CurrentConditions.CurrentForecast.TimeStamp.ToString(), smallFont, Color.White, 3, (AGENT.Contrib.Device.Size / 2) - smallFont.Height - 1);
}
开发者ID:nothingmn,项目名称:AGENT.Contrib,代码行数:29,代码来源:WeatherWatchFace.cs
示例17: Image
public Image(int x, int y, int width, int height, Bitmap bitmap, ushort opacity)
: base(x, y, width, height)
{
brush = new ImageBrush(bitmap);
brush.Stretch = Stretch.Fill;
Opacity = opacity;
}
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:7,代码来源:Image.cs
示例18: Main
public void Main(string ApplicationPath, string[] Args)
{
Form frmPacman = new Form("frmPacman");
frmPacman.ButtonPressed += frmPacman_ButtonPressed;
Bitmap bmpGame;
Picturebox pbGame;
bmpGame = new Bitmap(320, 240);
if (Prompt.Show("Resolution Adjust", "Would you like to play at 640x480?", Fonts.Calibri18Bold, Fonts.Calibri14, PromptType.YesNo) == PromptResult.Yes)
{
pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 320, frmPacman.Height / 2 - 240, 640, 480, BorderStyle.BorderNone);
pbGame.ScaleMode = ScaleMode.Stretch;
}
else
pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 160, frmPacman.Height / 2 - 140, BorderStyle.BorderNone);
pbGame.Background = Colors.Black;
game = new PacmanGame(bmpGame, pbGame);
frmPacman.AddControl(pbGame);
Graphics.ActiveContainer = frmPacman;
Thread.Sleep(100);
if (joystick != null)
{
game.InputManager.AddInputProvider(joystick);
game.Initialize();
}
}
开发者ID:joram,项目名称:Gadgeteer,代码行数:31,代码来源:Class1.cs
示例19: camera_BitmapStreamed
void camera_BitmapStreamed(Camera sender, Bitmap bitmap)
{
if (!picTimeout.IsRunning && GT.Timer.GetMachineTime() >= webcamStreamStopTime)
{
//Debug.Print("Stopping bitmap streaming");
camera.StopStreamingBitmaps();
}
if (responders.Count > 0)
{
byte[] bmpFile = new byte[bitmap.Width * bitmap.Height * 3 + 54];
GHI.Premium.System.Util.BitmapToBMPFile(bitmap.GetBitmap(), bitmap.Width, bitmap.Height, bmpFile);
GT.Picture picture = new GT.Picture(bmpFile, GT.Picture.PictureEncoding.BMP);
numresponses++;
Debug.Print("Sending webcam response " + numresponses + " to " + responders.Count + " clients");
foreach (HomeOSGadgeteer.Networking.Responder responder in responders)
{
try
{
responder.Respond(picture);
}
catch { }
}
responders.Clear();
}
if (picTimeout.IsRunning)
{
oledDisplay.SimpleGraphics.DisplayImage(lastBitmap, 0, 0);
oledDisplay.SimpleGraphics.Redraw();
Debug.Print("Picture streamed -> screen");
}
}
开发者ID:donnaknew,项目名称:programmingProject,代码行数:34,代码来源:Program.cs
示例20: Main
public static void Main()
{
MultiButtonHelper mbh = new MultiButtonHelper();
mbh.AddButtonHandler(new Buttons[] {Buttons.TopRight, Buttons.BottomRight,},
new MultiButtonHelper.HandleClicks(ResetAll));
// initialize display buffer
_display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight);
_drawing = new Drawing(_display);
menu = new Menu(menuFont, _display);
menu.OnMenuItemClicked += menu_OnMenuItemClicked;
menu.Items.Add(new MenuItem() {Title = "1 Minute", CommandArg = "1"});
menu.Items.Add(new MenuItem() {Title = "2 Minutes", CommandArg = "2"});
menu.Items.Add(new MenuItem() {Title = "3 Minutes", CommandArg = "3"});
menu.Items.Add(new MenuItem() {Title = "4 Minutes", CommandArg = "4"});
menu.Items.Add(new MenuItem() {Title = "5 Minutes", CommandArg = "5"});
menu.Items.Add(new MenuItem() {Title = "10 Minutes", CommandArg = "10"});
menu.Items.Add(new MenuItem() {Title = "15 Minutes", CommandArg = "15"});
menu.Items.Add(new MenuItem() {Title = "20 Minutes", CommandArg = "20"});
menu.Items.Add(new MenuItem() {Title = "30 Minutes", CommandArg = "30"});
menu.Items.Add(new MenuItem() {Title = "45 Minutes", CommandArg = "45"});
menu.Items.Add(new MenuItem() {Title = "60 Minutes", CommandArg = "60"});
ShowMenu();
// go to sleep; all further code should be timer-driven or event-driven
Thread.Sleep(Timeout.Infinite);
}
开发者ID:nicksi,项目名称:AGENT.Contrib,代码行数:29,代码来源:Program.cs
注:本文中的Microsoft.SPOT.Bitmap类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论