graphics

How to fix blinking/flashing

白昼怎懂夜的黑 提交于 2019-12-11 10:03:59
问题 Simple program that counts every time you click, however the image seems to blink/flash when clicked too fast. import java.awt.*; import java.awt.event.*; import java.awt.Graphics; import javax.swing.*; import java.lang.Object; import java.net.URL; import java.lang.String; import java.awt.Font; public class Spaceship extends Canvas { private Font font1; int myX = 100; int myY = 400; int count = 0; These are the 2 images that flash, the images used shouldn't matter though. Image img1 = Toolkit

HSV (0 .. 255) to RGB (0 .. 255) [duplicate]

谁说胖子不能爱 提交于 2019-12-11 09:54:56
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Algorithm to convert RGB to HSV and HSV to RGB? Can someone explain on how to convert an HSV value to an RGB when the value is 0 to 255? Also, For reference, I am trying to do this in C++. 回答1: Found it here http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript function hsvToRgb(h, s, v){ var r, g, b; var i = Math.floor(h * 6); var f = h * 6 - i; var p = v * (1 -

Non-linear Icosphere

喜欢而已 提交于 2019-12-11 09:54:24
问题 I need an icosphere with all edges the same length. Currently I generate one starting from an icosahedron and then linearly interpolate each triangle. All tutorials I could find used the same linear interpolation. Someone later suggested just using the icosphere from blender, which works, though also uses the linear interpolation... So anyone has a good tutorial on how to make an icosphere and make sure all the sides are equal? (It would also be ok if you know a program which can make this

Bitmap Writing Coming Out Diagonally

只谈情不闲聊 提交于 2019-12-11 09:50:27
问题 My code as follows is giving me issues trying to write a bitmap image with an odd size 250x250 pixels. When I write it with an evenly divisibly by 3 area, eg. 160x160 everything is fine. I have spent a few hours now trying to get the 250x250 and other odd area's to write correctly but they just won't, the image is diagonal and half of it with the wrong color bits. int screen_save_part(string filename,unsigned x,unsigned y,unsigned w,unsigned h) //Assumes native integers are little endian {

Under which conditions can I leave out the perspective division?

↘锁芯ラ 提交于 2019-12-11 09:37:51
问题 I want to revert a homogeneous transformation after performing a perspective division. To be more specific, I’m implementing a GPU-based voxelization algorithm using conservative rasterization. For an overview, these are the steps I’ve implemented so far (VS=vertex shader, GS=geometry shader): Apply the model transform to the vertices (VS). Apply an orthographic projection transform to a copy of each vertex (GS). Apply a view transform to the copies (GS). Perform a perspective division on the

Why is this 128Bit Color Format being converted to 32Bit

我的未来我决定 提交于 2019-12-11 09:18:34
问题 I am trying to write an HLSL pixel shader for a project I am working on. Basically want I want to do is if a texture has a pixel with a float value of 0.52 (on scale of 0-255 is 132.6) I want to output 133 60% of the time and output 132 40% of the time. Write now I am just trying to output the fractional remainder of the RGB value (i.e. the chance to bump the pixel up) however I always get a value of zero) I think this is because the colors are getting quantized to a 0-255 scale before they

Arc graphic quality

左心房为你撑大大i 提交于 2019-12-11 09:09:17
问题 Back here. Is there any way to improve the quality of the Arc? I'm using e.Graphics.SmoothingMode = SmoothingMode.AntiAlias This is the piece of code that creates the arc: using (GraphicsPath gp = new GraphicsPath()) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; gp.Reset(); gp.AddPie(_OuterRectangle, (float)_Properties.Origin, (float)_Properties.GaugeType); gp.Reverse(); gp.AddPie(_InnerRectangle, (float)_Properties.Origin, (float)_Properties.GaugeType); gp.Reverse(); pArea.SetClip(gp

Copy plot with grid.echo() from non-default device

最后都变了- 提交于 2019-12-11 09:03:17
问题 I want to copy a plot to a grid object from an svg device. grid.echo() docs says that it echoes the current device but drawn using grid graphics. However, the following does not work: svg() plot(1:10) print(dev.cur()) grid.echo() a = grid.grab() dev.off() print(dev.cur()) grid.draw(a) The printout from the above is: svg 2 null device 1 Warning message: In grid.echo.recordedplot(recordPlot(), newpage, prefix, device) : No graphics to replay As you can see, the current device is the svg device

Draw objects on a loaded image in java

佐手、 提交于 2019-12-11 08:57:49
问题 I need help with loading an image of a map and drawing a point on the received location. Here is the code of the server: import java.awt.Dimension; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Server extends JFrame{ private static int PACKETSIZE = 100 ; private static int WIDTH = 1340; private static int HEIGHT = 613; public DatagramSocket socket; public DrawPoint

What is the Xbox360's D3DRS_VIEWPORTENABLE equivalent on WinXP D3D9?

自作多情 提交于 2019-12-11 08:45:57
问题 I am maintaining a multiplatform codebase for Xbox360 and WinXP. I am seeing an issue on the XP side that appears to be related to D3DRS_VIEWPORTENABLE on the Xbox360 version not having an equivalent on WinXP D3D9. This article had an interesting idea, but the only way to construct an identity matrix is to supply negative numbers to D3DVIEWPORT9::X and D3DVIEWPORT9::Height, but they are unsigned numbers. (I tried to put in negative numbers anyway, but nothing interesting happened.) So, how