graphics

Gtk/GtkD Detect release of mouse button on window resize?

微笑、不失礼 提交于 2019-12-23 18:48:38
问题 I'm trying to improve a plotting library that I wrote with GtkD (the D bindings for Gtk). Scatter plots with a lot of points take a long time to resize. I want to rescale the image, allowing pixelation, while the user is dragging the window edge to resize, and only re-render it when the mouse button is released. Is there an API to detect whether the user is still holding down the mouse button to drag the window edge when a window is being resized? If you are not familiar with GtkD, a response

Embeding a XNA Game in a Windows Form User Control

≡放荡痞女 提交于 2019-12-23 18:21:07
问题 I have a simple XNA 4.0 Game written. I want to make a Windows Form User Control that will render this game, and provide the necessary interaction feedback (keyboard and mouse) back to XNA. I have tried the following: In XNA: Redirect XNA's Game.GraphicsDevice to a RenderTarget2D. Emit an event sending an object with KeyboardState and MouseState to be filled in by Windows Forms, at the beginning of Update() In WinForms: Capture the event, filling in KeyboardState and MouseState with data

Only one Paint event is being called

走远了吗. 提交于 2019-12-23 18:04:14
问题 My problem is that I have 8 pictureboxes and only one of them is getting their draw method called at a time. My code is a bit too large so I tried to narrow it down to the affected portions as much as I could. My best guess is that it's not so much a bug in my code, but a misunderstanding in how the draw event works. I have a class which inherits from PictureBox which I am using instead of Picturebox. The only change is the constructor using System.Drawing; using System.Windows.Forms; public

Java: Draw a circular spiral using drawArc

强颜欢笑 提交于 2019-12-23 17:43:30
问题 I'm working on a java programming exercise where we have to draw a circular spiral using the drawArc method so that the result looks similar to this: I've been working on this for a while and this is what I have so far: import java.awt.Graphics; import javax.swing.JPanel; import javax.swing.JFrame; public class CircSpiral extends JPanel { public void paintComponent(Graphics g) { int x = 100; int y = 120; int width = 40; int height = 60; int startAngle = 20; int arcAngle = 80; for (int i = 0;

How do I re-set a BMP file's resolution (DPI) indicator?

浪子不回头ぞ 提交于 2019-12-23 17:33:05
问题 I have a BMP tagged as 299 DPI resolution. I'd like to change that to 99 DPI. Importantly, the DPI marker in a BMP has no structural meaning. An image has a certain width and height in pixels . The displaying application can show the image at any width in inches. So, the DPI is just a hint. However, I am dealing with some third-party software which behaves differently depending on this marker, so I need to re-set it. I will appreciate suggestions on how to do this programmatically in Java, as

Make drawstring partially bold

无人久伴 提交于 2019-12-23 16:45:05
问题 Good morning. I have created a custom treeview control that paints a normal treeview onto the screen, plus various other things. During the paint event I draw the node.text string to the treeview control using the following method. node.text = "ABCDEFG" g.DrawString(node.Text, tvFont, Brushes.Black, strPosX + 10, bothPosY) Basically what I am trying to do is make part of the node.text italic, so that it renders on screen like so... AB*CDE*FG Personally I would approach this in such a way that

What does it mean by Page Flipping in computer graphics programming?

余生颓废 提交于 2019-12-23 16:27:35
问题 What does it mean by Page-Flipping? Why do we need it in graphics programming? 回答1: Page flipping refers to a technique for flicker-free graphics which has been with us for decades. Two different areas (pages) of computer RAM were mappable to the screen hardware, and one of them could be chosen to be visible at any given time with a very simple and instantaneous instruction to the hardware. So, frames would be rendered in the page which was at any time invisible, and then the hardware

Server-side graphics in ASP.NET Core

空扰寡人 提交于 2019-12-23 15:16:25
问题 I've recently upgraded an ASP.NET MVC application from ASP.NET to ASP.NET Core. In my controller action, I had a piece of code that relied on System.Drawing to create a profile picture using (FileStream stream = new FileStream(HttpContext.Server.MapPath($"~/Content/UserFiles/{AuthenticatedUser.Id.ToString()}.jpg"), FileMode.OpenOrCreate)) { Image image = Image.FromStream(model.DisplayPicture.InputStream); image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); } The image data is posted

How fill an Android Path that contain holes without filling the holes?

主宰稳场 提交于 2019-12-23 14:51:09
问题 I'm currently programming very simple game for Android (API level 7) to discover and learn the android SDK. This game involve drawing shape on the screen that will change colour when touched. Some shapes may embed one or several holes. My issue is : if I touch the shape, the whole thing's colour change, even the holes'. Here is the pseudo code I use, shape is the polygon I want to draw, boundary it's outer boundary, holes an array of its holes. Hole and boundary hold an array of their points.