private Bitmap RecreateBackground() { lock (GlobalFont) { if (Background != null) { Background.Dispose(); } bool tabsDisplayed = StatsForm.CurrentSettings.ShowOverlayTabs; Bitmap newImage = new Bitmap(drawWidth, drawHeight, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(newImage)) { g.DrawImage(Properties.Resources.background, 0, tabsDisplayed ? 35 : 0); if (tabsDisplayed) { g.DrawImage(Properties.Resources.tab_unselected, drawWidth - 110, 0); } } if (flippedImage) { newImage.RotateFlip(RotateFlipType.RotateNoneFlipX); } DrawGraphics.Dispose(); DrawImage.Dispose(); DrawImage = new Bitmap(newImage.Width, newImage.Height, PixelFormat.Format32bppArgb); DrawGraphics = Graphics.FromImage(DrawImage); return(newImage); } }
private void ComputeAndGeneratePicture() { _computeThemeAstral = new ComputeThemeAstral(Json, MaxWidth, MaxHeight); _sizeThemeAstralpx = this._computeThemeAstral.CalcDraw.getSizeWH().ToString() + "px"; _drawImage = new DrawImage(_computeThemeAstral); _swOk = true; }
public void LoadData(DrawImage obj, Form frm) { cbxSizeMode.Items.Clear(); cbxSizeMode.Items.Add(PictureBoxSizeMode.Normal); cbxSizeMode.Items.Add(PictureBoxSizeMode.AutoSize); cbxSizeMode.Items.Add(PictureBoxSizeMode.CenterImage); cbxSizeMode.Items.Add(PictureBoxSizeMode.StretchImage); cbxSizeMode.Items.Add(PictureBoxSizeMode.Zoom); objImage = obj; txtX1.Text = objImage.Rectangle.X.ToString(); txtY1.Text = objImage.Rectangle.Y.ToString(); txtName.Text = objImage.Name; txtText.Text = objImage.Filename; txtAngle.Text = objImage.Angle.ToString("F6"); txtW.Text = objImage.Rectangle.Width.ToString(); txtH.Text = objImage.Rectangle.Height.ToString(); for (int i = 0; i < cbxSizeMode.Items.Count; i++) { PictureBoxSizeMode sm = (PictureBoxSizeMode)(cbxSizeMode.Items[i]); if (sm == objImage.SizeMode) { cbxSizeMode.SelectedIndex = i; break; } } frmOwner = frm; }
public override void OnDraw(Graphics g) { base.OnDraw(g); //draw rectangle DrawImage.DrawImageOnRect(g, getBackImage()); if (_items != null) { DrawingPage.VerifyDrawingOrder(_items, false); GraphicsState gs = g.Save(); if (RotateAngle != 0) { double angle = (RotateAngle / 180) * Math.PI; Rectangle rc = this.Rectangle; g.TranslateTransform( (rc.Width + (float)(rc.Height * Math.Sin(angle)) - (float)(rc.Width * Math.Cos(angle))) / 2 + rc.X, (rc.Height - (float)(rc.Height * Math.Cos(angle)) - (float)(rc.Width * Math.Sin(angle))) / 2 + rc.Y); g.RotateTransform((float)RotateAngle); } else { g.TranslateTransform((float)(this.Left), (float)(this.Top)); } for (int i = 0; i < _items.Count; i++) { DrawingItem item = _items[i]; if (item.Visible) { item.OnDraw(g); } } g.Restore(gs); } }
public static void Main() { DrawImage di = new DrawImage(); di.box.Image = image(); Application.Run(di); }
private void DisplayVocabulary() { for (int i = 0; i < _vocabularies.Count; i++) { WriteLog.WriteLogSuccess(TAG, "DisplayVocabulary()", _vocabularies.ElementAt(i).stt + " - " + _vocabularies.ElementAt(i).vocabulary); } DrawImage.Draw(_vocabularies); }
private void btnTest1_Click(object sender, EventArgs e) { Line line = new Line(new Point(20, 20), new Point(50, 50)); DrawImage image = new DrawImage(this.pictureBox1.Width, this.pictureBox1.Height); line.Draw(image); this.pictureBox1.Image = image.Image; }
public static void DrawLogo() { string[] pepes = new string[] { "smoker", "monkaGun", "mariRage1" }; Random random = new Random(); Image img = Image.FromStream(new MemoryStream(Convert.FromBase64String(Resource.ResourceManager.GetObject(pepes[random.Next(pepes.Length)]).ToString()))); DrawImage.ConsoleWriteImage(img); Console.ResetColor(); }
private void btnTest3_Click(object sender, EventArgs e) { Wave wave = new Wave(-360, 360, 30); wave.HorizontalResize(0.5); wave.VerticalResize(2); DrawImage image = new DrawImage(this.pictureBox1.Width, this.pictureBox1.Height); wave.Draw(image); this.pictureBox1.Image = image.Image; }
private void DrawImageHandler(ref DrawImage value, int direction) { if (direction != 0) { direction = direction / Math.Abs(direction); } int val = (int)value; var len = Enum.GetNames(typeof(DrawImage)).Length; val = (val + len + direction) % len; this.Shader.Set(drawImageProp, val); value = (DrawImage)val; }
private void btnTest2_Click(object sender, EventArgs e) { Line line = new Line(new Point(20, 0), new Point(100, 0)); Composite composite = new Composite(); composite.Add(line); for (int k = 10; k <= 270; k += 10) { composite.Add(line.Duplicate().Rotate(k)); } DrawImage image = new DrawImage(this.pictureBox1.Width, this.pictureBox1.Height); composite.Draw(image); this.pictureBox1.Image = image.Image; }
public void ImageAss() { string[] strArr = { "zhangs", "lisi", "wangw" }; decimal[] demArr = { 0.88M, 0.11M, 0.01M }; decimal[] demArr1 = { 88M, 11M, 1M }; var image = DrawImage.GetPieImage("无敌", strArr, demArr); var zimage = DrawImage.GetColumnImage("huage", strArr, demArr1); var path = Server.MapPath("huage"); if (!Directory.Exists(path)) //创建文件夹的时候用绝对路径 { Directory.CreateDirectory(path); } image.Save(path + "/wudi.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); zimage.Save(path + "/huage.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); Image1.ImageUrl = "huage/wudi.jpg"; }
public void LoadDisplay(TabGraphicPageControl tabdisplaypagecontrol) { //GraphicsList graphicslist = new Draw.GraphicsList(); Pages = new PageList(tabdisplaypagecontrol); foreach (tblBitmap tblbitmap in m_tblBitmapCollection) { DrawImage obj = new DrawImage(Pages); obj.Load(tblbitmap); Pages.GraphicPagesList[Pages.ActivePageNo].Add(obj); } foreach (tblADText tbladtext in m_tblADTextCollection) { DrawText obj = new DrawText(Pages); obj.Load(tbladtext); Pages.GraphicPagesList[Pages.ActivePageNo].Add(obj); } foreach (tblLine tblline in m_tblLineCollection) { DrawLine obj = new DrawLine(Pages); obj.Load(tblline); Pages.GraphicPagesList[Pages.ActivePageNo].Add(obj); } foreach (tblRect tblrect in m_tblRectCollection) { switch ((STATIC_OBJ_TYPE)tblrect.Type) { case STATIC_OBJ_TYPE.ID_ELLIPS: DrawEllipse drawellipse = new DrawEllipse(Pages); drawellipse.Load(tblrect); Pages.GraphicPagesList[Pages.ActivePageNo].Add(drawellipse); break; case STATIC_OBJ_TYPE.ID_ROUNDRECT: case STATIC_OBJ_TYPE.ID_RECT: DrawRectangle drawrectangle = new DrawRectangle(Pages); drawrectangle.Load(tblrect); Pages.GraphicPagesList[Pages.ActivePageNo].Add(drawrectangle); break; } } foreach (tblPolyline tblpolyline in m_tblPolylineCollection) { DrawPolyLine drawpolyline = new DrawPolyLine(Pages); drawpolyline.Load(tblpolyline); Pages.GraphicPagesList[Pages.ActivePageNo].Add(drawpolyline); } foreach (tblPolygon tblpolygon in m_tblPolygonCollection) { DrawPolygon drawpolygon = new DrawPolygon(Pages); drawpolygon.Load(tblpolygon); Pages.GraphicPagesList[Pages.ActivePageNo].Add(drawpolygon); } foreach (tblCurve tblcurve in m_tblCurveCollection) { DrawCurve drawcurve = new DrawCurve(Pages); drawcurve.Load(tblcurve); Pages.GraphicPagesList[Pages.ActivePageNo].Add(drawcurve); } Pages.GraphicPagesList[Pages.ActivePageNo].SortoIndex(); }
public static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Welcome to LibClassicBot beta."); Console.WriteLine("Below is a list of commands and how to use them"); Console.WriteLine(".position - Announces the position of the bot in the map."); Console.WriteLine(".allow <user> - Adds a user to a list of allowed operators."); Console.WriteLine(".disallow <user> - Removes a user from the list of allowed operators."); Console.WriteLine(".say <message> - Makes the bot send the specified message."); Console.WriteLine(".players - Lists the visibile players to the bot in the current map."); Console.WriteLine(".move <x,y,z> - Moves the bot to the specified coordinates."); Console.WriteLine(".place <x,y,z> - Attempts to place a block at the specified coordinates."); Console.WriteLine(".haspaid <username> - Announces if a user has paid or not."); Console.WriteLine(".cuboid <blocktype> - Cuboids between two points."); Console.WriteLine(".cuboidh <blocktype> - Draws a hollow cuboid between two points."); Console.WriteLine(".cuboidw <blocktype> - Draws a wireframe between two points."); Console.WriteLine(".ellipsoid <blocktype> - Draws an ellipsoid between two points."); Console.WriteLine(".pyramid <blocktype> - Draws an upwards pyramid between two points."); Console.WriteLine(".follow <username> - Follows player. (Case sensitive)"); Console.WriteLine(".speed <number> - The number of blocks to place per second."); Console.WriteLine(".abort - Stops the currently running draw operation."); Console.WriteLine(".drawimg 0 <filename> - Attempts to draw the specified image."); Console.ResetColor(); Console.WriteLine("Enter the username to be used by the bot: (Minecraft account)"); string username = Console.ReadLine(); Console.WriteLine("Enter the password to be used by the bot: (Minecraft account)"); string password = Console.ReadLine(); Console.WriteLine("Enter the address of the server to connect to: "); string hash = Console.ReadLine(); if (!hash.StartsWith("http")) { if (hash.StartsWith("minecraft")) { hash = "http://" + hash; } else { hash = "http://minecraft.net/classic/play/" + hash; } } ClassicBot Bot1 = new ClassicBot(username, password, hash); ConsoleLogger logger = new ConsoleLogger(); Bot1.RegisterLogger(logger); FileLogger file = new FileLogger(); Bot1.RegisterLogger(file); Bot1.Events.ChatMessage += Bot1_ChatMessage; Bot1.Events.PlayerMoved += Bot1_PlayerMoved; Bot1.Events.RemoteSessionStarted += RemoteSessionStarted; Bot1.Events.RemoteUserLoggedIn += RemoteUserLoggedIn; Bot1.Events.RemoteSessionEnded += RemoteSessionEnded; #if !MONO Bot1.Events.MapLoaded += Bot1_MapLoaded; Bot1.Events.ConfigLoading += delegate { Console.WriteLine("Loading"); }; #endif #region Plugins CommandDelegate MazeCommand = delegate(string Line) { Maze maze = new Maze(); maze.originalchatline = Line; Bot1.SetDrawer(Line, maze, 2); }; Bot1.RegisteredCommands.Add("maze", MazeCommand); CommandDelegate DrawCommand = delegate(string Line) { DrawImage img = new DrawImage(); img.originalchatline = Line; Bot1.SetDrawer(Line, img, 2); }; Bot1.RegisteredCommands.Add("drawimg", DrawCommand); CommandDelegate PositionCommand = delegate(string Line) { Bot1.SendMessagePacket(String.Format("Positon in world is at {0},{1},{2}.", Bot1.X, Bot1.Y, Bot1.Z)); }; Bot1.RegisteredCommands.Add("position", PositionCommand); CommandDelegate AddOpCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.AddOperator(full[1]); Bot1.SendMessagePacket("Allowed user: "******"allow", AddOpCommand); CommandDelegate RemoveOpCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.RemoveOperator(full[1]); Bot1.SendMessagePacket("Disallowed user: "******"disallow", RemoveOpCommand); CommandDelegate ListOpsCommand = delegate(string Line) { string[] names = Bot1.Users.ToArray(); Bot1.SendLongChat(String.Join(", ", names)); }; Bot1.RegisteredCommands.Add("ops", ListOpsCommand); CommandDelegate SayCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.SendMessagePacket(full[1]); }; Bot1.RegisteredCommands.Add("say", SayCommand); CommandDelegate PlayersCommand = delegate(string Line) { List <string> Names = new List <string>(); foreach (Player player in Bot1.Players.Values) { Names.Add(player.Name); } string output = String.Join(",", Names.ToArray()); Bot1.SendLongChat("Players in current world: " + output); }; Bot1.RegisteredCommands.Add("players", PlayersCommand); CommandDelegate MoveCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); string[] coords = full[1].Split(new char[] { ',' }, 3); Bot1.SendPositionPacket(Int16.Parse(coords[0]), Int16.Parse(coords[1]), Int16.Parse(coords[2])); }; Bot1.RegisteredCommands.Add("move", MoveCommand); CommandDelegate PlaceCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); string[] coords = full[1].Split(new char[] { ',' }, 4); Bot1.SendBlockPacket(Int16.Parse(coords[0]), Int16.Parse(coords[1]), Int16.Parse(coords[2]), 1, Byte.Parse(coords[3])); }; Bot1.RegisteredCommands.Add("place", PlaceCommand); CommandDelegate HasPaidCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); try { bool paid; WebClient client = new WebClient(); string response = client.DownloadString("https://minecraft.net/haspaid.jsp?user="******"minecraft.net returned: " + (int)response.StatusCode + " " + response.StatusCode.ToString()); } } else { Bot1.SendMessagePacket("Unhandled error occured: " + ex.Status.ToString()); } } }; Bot1.RegisteredCommands.Add("haspaid", HasPaidCommand); CommandDelegate FollowCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); personfollowed = full[1]; Bot1.SendMessagePacket("Following user " + full[1]); }; Bot1.RegisteredCommands.Add("follow", FollowCommand); CommandDelegate CuboidCommand = delegate(string Line) { Cuboid cuboid = new Cuboid(); Bot1.SetDrawer(Line, cuboid, 2); }; Bot1.RegisteredCommands.Add("cuboid", CuboidCommand); CommandDelegate PyramidCommand = delegate(string Line) { Pyramid pyramid = new Pyramid(); Bot1.SetDrawer(Line, pyramid, 2); }; Bot1.RegisteredCommands.Add("pyramid", PyramidCommand); CommandDelegate AbortCommand = delegate(string Line) { Bot1.CancelDrawer(); personfollowed = String.Empty; }; Bot1.RegisteredCommands.Add("abort", AbortCommand); CommandDelegate SpeedCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.CuboidSleepTime = 1000 / Int32.Parse(full[1]); }; Bot1.RegisteredCommands.Add("speed", SpeedCommand); CommandDelegate EllipsoidCommand = delegate(string Line) { Ellipsoid ellipsoid = new Ellipsoid(); Bot1.SetDrawer(Line, ellipsoid, 2); }; Bot1.RegisteredCommands.Add("ellipsoid", EllipsoidCommand); CommandDelegate CuboidHCommand = delegate(string Line) { CuboidHollow cuboidh = new CuboidHollow(); Bot1.SetDrawer(Line, cuboidh, 2); }; Bot1.RegisteredCommands.Add("cuboidh", CuboidHCommand); CommandDelegate CuboidWCommand = delegate(string Line) { CuboidWireframe cuboidw = new CuboidWireframe(); Bot1.SetDrawer(Line, cuboidw, 2); }; Bot1.RegisteredCommands.Add("cuboidw", CuboidWCommand); CommandDelegate LineCommand = delegate(string Line) { Line line = new Line(); Bot1.SetDrawer(Line, line, 2); }; Bot1.RegisteredCommands.Add("line", LineCommand); CommandDelegate IgnoreCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.IgnoredUserList.Add(full[1]); Bot1.SendMessagePacket("Ignored user: "******"ignore", IgnoreCommand); CommandDelegate UnIgnoreCommand = delegate(string Line) { string[] full = Bot1.GetMessage(Line).Split(new char[] { ' ' }, 2); Bot1.IgnoredUserList.Remove(full[1]); Bot1.SendMessagePacket("Unignored user: "******"unignore", UnIgnoreCommand); /*CommandDelegate TestPosCommand = delegate(string Line) * { //Ain't no way to stop it. Uncomment with severe caution. * new System.Threading.Thread( * delegate() { * Random rnd = new Random(); * while(true){ * * int rndval1 = rnd.Next(0, 360); * byte newpitch = Extensions.DegreesToYaw(rndval1); * int rndval2 = rnd.Next(0, 360); * byte newyaw = Extensions.DegreesToYaw(rndval2); * Bot1.SendPositionPacket(Bot1.X, Bot1.Y, Bot1.Z, newyaw, newpitch); * System.Threading.Thread.Sleep(10); * } * }).Start(); * }; * Bot1.RegisteredCommands.Add("testpos", TestPosCommand);*/ #endregion StaticBot1 = Bot1; Bot1.Start(false); loop: { string response = Console.ReadLine(); Bot1.SendMessagePacket(response); goto loop; } }
public void Display() { var image = ConfigurationManager.AppSettings["BooldogImage"]; DrawImage.DrawImageInConsole(image); }