graphics

SurfaceView appears empty, nothing being rendered

时间秒杀一切 提交于 2019-12-23 05:25:30
问题 I'm trying to draw some shapes onto a SurfaceView from within a thread, but nothing is being rendered to the screen. I've looked at similar questions by people having the same problem, but none of the answers have led me to a solution, suggesting a different cause in my particular case. I've created a simplified version of my code to demonstrate the problem. Rendering is handled by the RenderingTestView class, which implements a custom view derived from SurfaceView. The rendering thread is

plot multiple graphs from multiple files gnuplot

家住魔仙堡 提交于 2019-12-23 05:24:06
问题 I have a set of files named like this: qd-dPZ-z1-1nn.dat qd-dPZ-z2-1nn.dat qd-dPZ-z4-1nn.dat qd-dPZ-z8-1nn.dat qd-dPZ-z16-1nn.dat qd-dPZ-z32-1nn.dat qd-dPZ-z1-2nn.dat qd-dPZ-z2-2nn.dat qd-dPZ-z4-2nn.dat qd-dPZ-z8-2nn.dat I need to generate a graph for each file (from file qd-dPZ-z1-1nn.dat generate graph qd-dPZ-z1-1nn.ps from file qd-dPZ-z2-1nn.dat generate graph qd-dPZ-z2-1nn.ps and so on) So far, I´ve tried gnuplot> filenames = "qd-dPZ-z1-1nn.dat qd-dPZ-z2-1nn.dat qd-dPZ-z4-1nn.dat qd-dPZ

iOS - Calculating percent of a color in an area

≯℡__Kan透↙ 提交于 2019-12-23 05:23:59
问题 I may not always understand every function in an API but usually I can at least get started on a problem. This time I don't even know if this is possible or how to attack it.... I have an area on the screen that a user can draw. This works fine. They draw with three different colors indicating three different cases. I need to detect the percent coverage of the three different colors in the area. There does not seem to be any way to get the color value of a single screen pixel. How would you

Lua Gideros: Line with touch 2

和自甴很熟 提交于 2019-12-23 04:52:18
问题 In my game using Lua and Gideros studio, I want someone to draw a straight line from mouse down to mouse up. Here is my code that doesn't work: local function onMouseDown(event) startx = event.x starty = event.y event:stopPropagation() end local function onMouseUp(event) endx = event.x endy = event.y local line = Shape.new() line:setLineStyle(5, 0x0000ff, 1) line:beginPath() line:moveTo(startx,starty) line:lineTo(endx,endy) line:endPath() event:stopPropagation() end place:addEventListener

How to Draw a Rubber Band Selection Rectangle accurately on a Rotated Canvas?

只愿长相守 提交于 2019-12-23 04:50:46
问题 This is a rubber band selection rectangle drawn on a canvas. My problem is that it is easy to get the correct size of the rectangle provided the canvas contents are not rotated. But as soon as it is rotated the rectangle no longer sizes with the cursor. I need the rubber band to stay parallel with screen var dragPt = new PointF(e.Position.X - G.ReferenceOffset.X, e.Position.Y - G.ReferenceOffset.Y); var rotation = ADEEnvironment.RotateAngle; var width = (dragPt.X - pressPt.X); var height =

Projection of Square onto 2D Plane (OpenGL ES2)

二次信任 提交于 2019-12-23 04:42:30
问题 I'm in the process of creating a coverflow view for android, but I'm running into a little bit of a roadblock when handling clicks on the view. I'm having trouble determining which square is beneath the click. In order to determine which square is clicked, the (X,Y) data from the click event is taken and converted into the opengl view space. The trouble comes when placing this on a square: the transposition, rotation, and compares can all be done in java, but this seems like a huge waste,

How fast is the jscript garbage collector? Three.js Matrix Rotations

主宰稳场 提交于 2019-12-23 04:35:29
问题 I am using these two functions in order to rotate my objects in my three.js scenes // Rotate an object around an arbitrary axis in object space function rotateAroundObjectAxis(object, axis, radians) { rotationMatrix = new THREE.Matrix4(); rotationMatrix.makeRotationAxis(axis.normalize(), radians); object.matrix.multiplySelf(rotationMatrix); // post-multiply object.rotation.getRotationFromMatrix(object.matrix, object.scale); delete rotationMatrix; } // Rotate an object around an arbitrary axis

Java NetBeans IDE - Animation Flickering in JPanel

雨燕双飞 提交于 2019-12-23 04:33:35
问题 I am currently learning Java Animation and graphics in NetBeans. I decided to start off with a simple ball movement in JPanel. I am having some problem with fixing the flickering a flickering problem. I have looked at many forums but most were for AWT using Double Buffering,but I came to know that SWING components don't need Double Buffering. I tried - using repaint() and . clearRect() . Out of the 2 I found that using . clearRect() gave me better results, but not seamless flicker-free

Importing custom images into graphics.py

断了今生、忘了曾经 提交于 2019-12-23 04:14:07
问题 How can I import a PNG-file into graphics.py and use it as if it were created within graphics.py? import graphics from graphics import * window = GraphWin("gameWindow", 800, 600) myImage = "myimage.png" myImage.draw(window) window.mainloop() 回答1: You can use the Image class. If the call as only two parameters, will assume that the second parameter is the file path of your file: myImage = Image(Point(5,5), 'myimage.png') The following works fine but I don't think Tkinter (what is used by

Why does the color after Image.Clear(x) not exactly equal the color x?

China☆狼群 提交于 2019-12-23 03:50:35
问题 The sample code for this issue is largely self-explanatory, so: [Fact] private void Color_in_should_equal_color_out() { var bitmap = new Bitmap(128,128,PixelFormat.Format32bppArgb); var color = Color.FromArgb(30,60,90,120); using (var g = Graphics.FromImage(bitmap)) { g.Clear(color); } var result = bitmap.GetPixel(0,0); Assert.Equal(color, result); } In this instance I would expect the color of the background to be identical to the color I cleared it to. Instead I get this: Assert.Equal()