graphics

Getting the (starting) X and Y coordinates of a Path2D shape drawn on Jpanel

送分小仙女□ 提交于 2019-12-12 07:07:32
问题 So, I have a program where I can add shapes to JPanel using Path2D objects and then I can click and drag them around. What I want to do is be able to find the final X and Y coordinates of the shape AFTER it has been drug. The coordinates need to be the top-left coordinates . Any ideas? // add a circle to center of the screen public void addCircle(int width, int height) { Path2D circ = new Path2D.Double(); circ.append(new Ellipse2D.Double(getWidth() / 2 - width / 2, getHeight() / 2 - height /

Draw in composite [closed]

折月煮酒 提交于 2019-12-12 06:50:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I have a Composite called Workspace. In this composite I want to add some graphics object. Each object can be selected, dragged, moved and can have complicated shape (circle, ellipse, polygon,...). I can click at

Adding user-defined color in function putpixel(int x,int y,int color)

扶醉桌前 提交于 2019-12-12 06:48:29
问题 I am trying to add orange color to my graphics code program. I am using putpixel(int x, int y, int color) function to add color. This function is not allowing to me to do so. Here's my code , Please help me to solve this problem #include<iostream> #include<graphics.h> int main() { int gd=DETECT,gm; initgraph(&gd,&gm,NULL); int height,width; height=10; width=75; while(height!=43) { putpixel(width,height,12); //here i want to add orange color width++; if(width==225) { width=76; height++; } }

TImagelist not adding bitmap

◇◆丶佛笑我妖孽 提交于 2019-12-12 06:46:36
问题 I'm at my whits end... trying to get a custom list of pictures, a TImageList and a TListView to work together. Original problem: No dynamically-added pictures are displayed in the list. Narrowed it down, problem is in the TImagelist. Code is below. ilMain is the TImagelist (defined elsewhere). Adding a bitmap to the list, immediatly retrieving it, first "Draw" works fine but the sedond fails... what am I missing here? var i:integer; test:TSch; currentimage :TBitmap; stupid :TBitmap; begin

Graphics Stuttering in Java (Space Invaders)

大兔子大兔子 提交于 2019-12-12 06:40:06
问题 I am creating a Space Invaders Game with just one Invader. The images are stuttering and are only visible ~10% of the time. What is wrong with my code? package spaceinvader; import javax.swing.*; import java.awt.event.*; import java.awt.*; public class spaceInvaders extends JApplet implements KeyListener, ActionListener { //Declare components and variables JPanel mainPanel = new JPanel(); ImageIcon carImage = new ImageIcon("ship.png"); ImageIcon invaderImage = new ImageIcon("invader.png");

How to tint an ImageIcon [duplicate]

旧巷老猫 提交于 2019-12-12 06:35:09
问题 This question already has an answer here : How to draw a BufferedImage with a color tint (1 answer) Closed 4 years ago . How would I tint the icon that is passed through here to be a different color? Say I wanted to take a white image and make it a bit darker. I have looked into BufferedImages and such but I can't seem to find anything that will fit into the setup that I am using. I should also note that I am drawing the images onto a JLabel if that makes a difference. Here is the source that

how to make .3ds file for a simple triangle

六眼飞鱼酱① 提交于 2019-12-12 06:17:40
问题 I have a code that parses .3ds file and uplaod the mesh. I have couple .3ds files but there is a bug in my code. So right now i'm trying to generate a simple .3ds file (aka a single triangle or a cube) but I'm not sure how to create a .3ds file. The files I currently have are encrypted. I found couple on other websites and they don't have any simpler models. How do you make .3ds file for a simple triangle and a cube? Is there an existing software that can make one? or can i write a script for

Java component not updating most of the time

安稳与你 提交于 2019-12-12 06:13:29
问题 I think I may have found a platform issue with openjdk-1.8.0_45 under ubuntu 15.04. The following program compiles and runs: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; public class TimerTime extends JPanel implements ActionListener { private JLabel timeLabel; public TimerTime() { timeLabel = new JLabel( String.valueOf(System.currentTimeMillis()); add( timeLabel ); Timer timer = new Timer(50, this); timer.setInitialDelay(1);

Run OGRE SDK failed

拜拜、爱过 提交于 2019-12-12 05:59:12
问题 I am new to Ogre. I downloaded OgreSDK_vc9_v1-7-4 and I want to run it using VS2008. After I extract the source code from it, I open folder OgreSDK_vc9_v1-7-4\Samples\Browser. It builds and runs successfully. But then an error dialog appears.The information is : ERROR: These requested sample plugins were either missing, corrupt or invalid. _:.\Sample_BezierPatch_d _:.\Sample_BSP_d etc I did this as the book "OGRE 3D 1.7 Beginner's Guide" said. Have I missed something? 回答1: When building Ogre,

Tile Projection Google Maps: Convert Distance to Screen Dimensions

谁说胖子不能爱 提交于 2019-12-12 05:49:40
问题 I am using the CanvasTileProvider in Google Maps Android v2. I can convert lat long points to screen pixels. However I would like to create a method to convert a distance to screen pixels. This will allow me to draw a circle of x radius. Can anyone help with this? The code below I have butchered and modified from somewhere else so credit to the original author. /** * Converts between LatLng coordinates and the pixels inside a tile. */ public class TileProjection { public int x; public int y;