drawing

wxImage and draw raw rgb bytes

一笑奈何 提交于 2019-12-13 04:09:44
问题 I am programming image viewer as school task and I cant use any libraries for reading or manipulating images. First I started with bmp format. I have created class for handle this type of file. As GUI framework I am using wxWidgets. So I have plain rgb bytes array, prepared for wxImage constructor wxImage(int width, int height, unsigned char* data, bool static_data = false). Problem is that when I convert it to wxBitmap and draw to dc it's ignoring rgb values a draw only black picture. I

C# Drawing in a Panel

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:48:53
问题 I want to draw in a panel with this method: protected override void InitOutput(object output) { if (output is Control) { Control c = (Control)output; g.FillRectangle(hb, 7, 10, 30 - 19, 5); ... } With a text I can do this: protected override void InitOutput(object output) { if (output is Control) { Control c = (Control)output; lbl.Name = "lbl"; lbl.Size = new System.Drawing.Size(10, 10); lbl.TabIndex = 5; lbl.Text = "test"; panel.Location = new System.Drawing.Point(1, 1); panel.Name =

Java Challenge on Permitting the User to Draw A Line

£可爱£侵袭症+ 提交于 2019-12-13 03:43:45
问题 My question has been alluded to in java draw line as the mouse is moved, however, I have not advanced far enough into this book to have covered JPanels, JFrames and Points as stated by the prior programmer who asked this question. Answering this question definitely would help most beginner programmers better understand the graphics class and drawing, an often intricate process, especially for beginners. According to the text I am using (as I am learning Java on my own), this was the example

as3 draw with mouse and erase lines when hitTestObject is reached

谁说我不能喝 提交于 2019-12-13 02:59:02
问题 I am trying to create a simple hitTestObject and see the lines that are being drawing on screen hit with a Ball. If it does it will erase all lines and start fresh. I am very close. The checkIt() function is where the code needs to happen and its clearing the lines but not making a new shape. How can I erase the lines the mouse drew and start fresh when a hit test is reached? var myshape:Shape; myshape = new Shape(); myshape.graphics.lineStyle(12, 0xC807DE); var alreadyDrawn:Shape;

Draw custom ellipse in winform

♀尐吖头ヾ 提交于 2019-12-13 02:56:50
问题 In System.Drawing and System.Drawing.Drawing2D , I can only draw horizontal or vertical shape. Now i want to draw custom shape. Given the coordinate of points A, B, C, D. I want to draw an ellipse like the blue one in the picture. 回答1: The example below is taken from MSDN: private void RotateTransformAngle(PaintEventArgs e) { // Set world transform of graphics object to translate. e.Graphics.TranslateTransform(100.0F, 0.0F); // Then to rotate, prepending rotation matrix. e.Graphics

JS Draw line between two or more points

本小妞迷上赌 提交于 2019-12-12 22:28:31
问题 i need to draw a line between two tags or tags. Example: http://caitriona.github.io/connect-the-dots/ I need to do something like this but not like in this script, in an order but randomly. You can click on "P1" and then on "P2" and the line will be drawn. But if you click on "P1" and then on "P3" an error message should appear (that's not the problem). My problem is, that I'm not so much a javascript crack to draw the line between the points. Can someone point me to the right direction?

System Drawing Invert Region build out of Path

佐手、 提交于 2019-12-12 17:23:25
问题 Ive got a panel and im drawing a heart on that panel .. But i dont want to draw the heart i want to draw everything except the heart so the heart is transparent. Can i invert the Region selected out of the Path ? System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddArc(0, 0, (this.Width / 2), (this.Height / 2), 135, 195); path.AddArc((this.Width / 2), 0, (this.Width / 2), (this.Height / 2), 210, 195); path.AddLine((this.Width / 2), this.Height,

Create line extensions for given line created by user

不羁岁月 提交于 2019-12-12 17:09:01
问题 I've been working in an app which I have to capture user's touches and draw a line on the screen. This is working so far. The problem is that I'd like to create some kind of extension for that line that goes from the line start/end to the screen boundaries. It's important to that extension be aligned to the main line. I've been trying to accomplish this for some days but without positive results. My idea was to use some kind of linear equation to represent the line and after create two point

JavaFX 2 path drawing performance

随声附和 提交于 2019-12-12 14:53:15
问题 I have a JavaFX Group with a Path Node added to it, to which I add data approximately 30 times per second. This causes my whole GUI to become very laggy and unresponsive after about a minute. First, I add the path to the Group like this: root.getChildren().add(path); Data is added like this: while(true) { // Calculate x and y... path.getElements().add(new LineTo(x, y)); path.getElements().add(new MoveTo(x, y)); // Sleep 33 milliseconds... } If I do not add the path to the group, but still add

cocoa — What is the proper way to tell an NSWindow to redisplay its contents?

梦想的初衷 提交于 2019-12-12 13:34:23
问题 According to the NSWindow Class Reference, you should "rarely need to invoke" the NSWindow methods "display" or "setViewsNeedDisplay". So what is the usual way to redisplay the window's contents? EDIT: I am having trouble dealing with resizing events. I just want to have everything scale proportionally. See this question. As no one seems to have any ideas for using masks to get it to happen, I want to redraw the whole thing. 回答1: Jason's comment really should be an answer: Generally you don't