graphics

Midpoint thick ellipse drawing algorithm

本小妞迷上赌 提交于 2020-02-03 04:46:06
问题 I'm really close to getting a thick ellipse algorithm working but I'm having a bit of trouble. I've taken the midpoint thick circle algorithm from here, and the midpoint ellipse algorithm from here, and I'm trying to combine them together to get the midpoint thick ellipse algorithm. I'm doing this because Googling "midpoint thick ellipse algorithm" didn't show what I'm looking for. The output from my attempt resembles a thick circle (images are at the bottom of the post). This is the image

Animate path (line) from last known point to new added point (d3)

﹥>﹥吖頭↗ 提交于 2020-02-02 13:45:26
问题 I'm still learning to program and I'm currently trying out the d3 library. So far I'm pretty happy with the result. fiddle Q: If you check out the link (or part of the code under this question) you should try to plot a point. This is only possible on the x-axis ticks. You'll see it animates but it's not exactly what I want. I just want it to animate the newly added line. I have checked out .enter() and .append() but I was getting errors. I might be doing something wrong. function lines(x, y)

Draw lines on a PictureBox

烈酒焚心 提交于 2020-02-02 04:08:13
问题 My question is related to Stack Overflow question Draw lines on a picturebox using mouse clicks in C# , but when the mouse button is up, the drawn line disappears. How do I fix this? private void GainBox_MouseDn(object sender, MouseEventArgs e) { mouse_dn = true; } private void GainBox_MouseMv(object sender, MouseEventArgs e) { //Line drawn from lookup table if (mouse_dn) { img = new Bitmap(256, 256); //Get the coordinates (x, y) for line from lookup table. for (x = x1; x < x2; x++) img

OpenGL compressed textures and extensions

删除回忆录丶 提交于 2020-02-01 04:48:05
问题 I've an nVidia Quadro NVS 295/PCIe/SSE2 card in which when I do glGetString(GL_EXTENSIONS) , print out the values and grep for "compress", I get this list GL_ARB_compressed_texture_pixel_storage GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_NV_texture_compression_vtc But then again glCompressedTexImage2D says that glGet with GL_COMPRESSED_TEXTURE

Poor results with source-over alpha blending (HTML5 canvas)

依然范特西╮ 提交于 2020-02-01 03:15:06
问题 Edit: I don't necessarily need a solution to this problem--rather I'd like to understand why it's occurring. I don't see why I should be getting the odd results below... Although this question is directed towards an issue I'm having with an HTML5 canvas application, I think the problem is less specific. I have an HTML5 canvas app that allows you to stamp images on the screen. These images are 32bit PNG's, so I'm working with transparency. If I stamp a highly transparent image in the same

Getting the Graphics2D?

感情迁移 提交于 2020-01-30 09:09:06
问题 public void paint(Graphics g){ Graphics2D g2 = (Graphics2D)g; // double r = 100; //the radius of the circle //draw the circle Ellipse2D.Double circle = new Ellipse2D.Double(0, 0, 2 * r, 2 * r); g2.draw(circle); This is part of a class within my program, my question lies in the Graphics2D g2 = (Graphics2D)g; Why must you include the "g" after the (Graphics2D), and what exactly does the "Graphics2D" Within the parenthesis mean, i am learning out of a book and neither of these were ever fully

Graphics.DrawString center in printdocument width

一笑奈何 提交于 2020-01-30 08:52:05
问题 I'm attempting to center a string on a printdocument. I've done the following with an image and it works but doesn't seem to work the same with a string. Here is the code that I used to center the image e.Graphics.DrawImage(logo, (e.MarginBounds.Width / 2) - (logo.Width / 2), height); The text i'm trying to center is being supply from a Tab in a TabControl using (var sf = new StringFormat()) { height = logo.Height + 15; sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment

Graphics.DrawString center in printdocument width

元气小坏坏 提交于 2020-01-30 08:52:05
问题 I'm attempting to center a string on a printdocument. I've done the following with an image and it works but doesn't seem to work the same with a string. Here is the code that I used to center the image e.Graphics.DrawImage(logo, (e.MarginBounds.Width / 2) - (logo.Width / 2), height); The text i'm trying to center is being supply from a Tab in a TabControl using (var sf = new StringFormat()) { height = logo.Height + 15; sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment

compute next point on a line with known slope

自闭症网瘾萝莉.ら 提交于 2020-01-25 12:17:05
问题 according to the line equation y = (m * x ) + c. if I know the slope(m) and I know that the line pass through a point(cx, cy). I want to know the next points on the same line before and after cx, cy, how do I go about to compute them. 回答1: In C++: Compute the other points by doing extrapolate line(m, cx, cy); double y_before = line.y(cx - 1); // for example double y_after = line.y(cx + 1); See it live on http://ideone.com/BELNc (two examples) struct extrapolate { extrapolate(double slope,

How is a 3D morph implemented in computer graphics?

南楼画角 提交于 2020-01-25 09:16:27
问题 I want to generate an intermediate mesh from several meshes like cups, but I didn't find any available paper, open source code, or another resource to do so. So, how can I generate such a mesh? 回答1: I am not aware of any open source library for this. But research literature is very broad and deep. Basically the ingredients are: Mesh parameterization Remeshing Basically you need to parameterize (embed) all the surfaces to a canonical domain such as a plane, sphere or some suitable (genus