graphics

Java: Drawing using Graphics outside the class which draws the main canvas

≯℡__Kan透↙ 提交于 2019-12-25 02:23:38
问题 I'm trying to develop a Tic Tac Toe game in Java using Graphics. My problem is: I don't want to add any other methods inside my Grid.class (which draws the lines 3x3), but i want to draw my X or O from a class called Game. My grid class looks like the following: import java.awt.Graphics; import javax.swing.JPanel; public class Grid extends JPanel{ private final int ITEM_WIDTH = 30; private final int ITEM_HEIGHT = 30; private final int OUTER_WIDTH = 90; private final int OUTER_HEIGHT = 90;

can you make an image button move in the same was as a bitmap in android

荒凉一梦 提交于 2019-12-25 02:13:19
问题 for the code I have a little android guy walk accross the screen, however this is using a bitmap how could I change it so it is an image button so I can click him and make it do somthing he is the code I have used for the bit map moving. canvas.drawBitmap(AndroidDude, AndroidDudeChangingX, (canvas.getHeight()/2 - (AndroidDude.getHeight()/2)), null); if (AndroidDudeChangingX < canvas.getWidth() - 280) { AndroidDudeChangingX += 10; } else { AndroidDudeChangingX = 0; } 回答1: You don't need an

server-side graphics generation in .net/c#

半城伤御伤魂 提交于 2019-12-25 02:00:11
问题 Is there a "correct" way in .net (MVC/c#, etc) to dynamically generate images in a way like this site does: http://www.fodey.com/generators/newspaper/snippet.asp And/or, are there third party toolkits to help with such things? I'm aware of the low level graphics api's, but would be curious how to handle more advanced things like font layout, pagination, etc. in a way that doesn't require a ton of manual coding. 回答1: There are a lot of imaging libraries out there. IMO there is no "best

Loading FBX model into DirectX application

僤鯓⒐⒋嵵緔 提交于 2019-12-25 01:56:23
问题 I am trying to render a 3d model from FBX file in my directx application, so I have loaded it using fbx sdk, but I found a big problem, probably caused by different coordinate system: DirectX use left handed, Fbx - right handed, so finally I got it rendered, but with two issues: all parts of the model look mirrored by Z axis (or by X - its not clear) position of the parts is incorrect after applying transformation matrix provided by FBX for each part; So how what I can do with Vertex data and

opengl: question about glutMainLoop()

只谈情不闲聊 提交于 2019-12-25 01:49:23
问题 can somebody explain how does glutMainLoop work? and second question, why glClearColor(0.0f, 0.0f, 1.0f, 1.0f); defined after glutDisplayFunc(RenderScene); cause firstly we call glClear(GL_COLOR_BUFFER_BIT); and only then define glClearColor(0.0f, 0.0f, 1.0f, 1.0f); int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(800, 00); glutInitWindowPosition(300,50); glutCreateWindow("GLRect"); glutDisplayFunc(RenderScene);

How to use JLayered Pane to display an image on top of another image?

一笑奈何 提交于 2019-12-25 01:46:37
问题 We are working on a pacman game and we want to add a picture of pacman on top of the background. If someone could provide some example code of implementing the Jlayered Pane that would be great. Here is some of the code we attempted to write. When we try to run it, nothing displays: JLayeredPane pacman = new JLayeredPane(); pacman.setPreferredSize(new Dimension(576, 655)); ImageIcon sprite = new ImageIcon("C:\\\\Users\\\\16ayoubc\\\\Desktop\\\\Pacman-moving.gif"); ImageIcon background = new

Blending antialiased circles

丶灬走出姿态 提交于 2019-12-25 01:45:12
问题 I've implemented Xiaolin Wu algorithm to draw an antialiased circle. And it works. However, in my app, I can draw on the screen many circles and they don't have full opacity. So, I want to blend them. Before implementing antialiasing Xiaolin Wu algorithm my blending method worked. I use very simple blending: int blendColors(int a, int b, float t) { double s = sqrt((1 - t) * a * a + t * b * b); return s; } void setPixel(int index, int r, int g, int b, int a, unsigned char* data) { int oldR =

How to apply an effect on screen image in Windows on the fly?

痴心易碎 提交于 2019-12-25 01:29:42
问题 I'm developing a Windows application that needs to apply an effect on screen image. More specifically, I need to do the following: grab a screen image, apply a gaussian blur on it, and display it on the screen. Something similar to f.lux, only in my case the effect applied is different. Since I'm new in Windows development, I'd like to know what is the recommended way to do it? What libraries/frameworks should I use? Can you point to some code samples of similar applications? Thanks! 来源:

Is it possible to get principal point from a projection matrix?

守給你的承諾、 提交于 2019-12-25 01:28:02
问题 Is it possible to get principal point (cx, cy) from a 4x4 projection matrix? This is the same matrix asked in this question: Getting focal length and focal point from a projection matrix (SCNMatrix4) s = (m11 = 1.83226573, m12 = 0, m13 = 0, m14 = 0, m21 = 0, m22 = 2.44078445, m23 = 0, m24 = 0, m31 = -0.00576340035, m32 = -0.0016724075, m33 = -1.00019991, m34 = -1, m41 = 0, m42 = 0, m43 = -0.20002, m44 = 0) The values I'm trying to calculate in this 3x3 camera matrix is x0 and y0. 来源: https:/

Creating contour or percentile lines in R

大憨熊 提交于 2019-12-25 01:22:13
问题 I am creating the following contour graph from this matrix. I would like to, however, have also a plot which displays chosen by me contour lines (without filled contour) representing values of 0.50 (in black) and 0.25 and 0.75 (in red). Help on the method will be much appreciated. B = matrix(c(0.158,0.182,0.306,0.46,0.601,0.77,0.796,0.832, 0.174,0.216,0.373,0.58,0.769,0.862,0.907,0.929, 0.164,0.262,0.442,0.73,0.886,0.93,0.949,0.976, 0.171,0.218,0.509,0.791,0.915,0.972,0.987,0.992, 0.174,0.288