graphics

Issue with Canvas.rotate() in Android .How does it exactly work?

别说谁变了你拦得住时间么 提交于 2019-12-13 04:39:37
问题 Please find the code of my onDraw method below(.I'm trying to rotate the canvas(//Rotate call -b) by 25 degrees after drawing the arc .But i find that the arc is still drawn from 0 to 50 degrees.I was expecting it to move by another 25 degrees. public class CustomView extends View { public CustomView(Context context) { super(context); } public CustomView(Context context, AttributeSet attrs) { super(context, attrs); } protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint =

Creating umbrella titles for aligned graphs in R

我只是一个虾纸丫 提交于 2019-12-13 04:38:51
问题 I have succeeded in creating and aligning three scatter-plots in R, using the following code: par(mfrow = c(3,1)) plot(CGP.GOSL ~ FPT.MAF.GOSL, data = all.locs, main = "A. Place I") abline(h=c(0.5)) abline(v=c(0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5), lty=2) plot(CGP.IRE ~ FPT.MAF.IRE, data = all.locs, main = "B. Place II") abline(h=c(0.5)) abline(v=c(0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5), lty=2) plot(CGP.BAR ~ FPT.MAF.BAR, data = all.locs, main = "C. Place III"

java - BufferStrategy is not creating stategy? (nullpointerexception)

谁说胖子不能爱 提交于 2019-12-13 04:37:57
问题 I decided to start understanding BufferStrategy for my graphics. I'm not sure if using my jframe in a static form is what's cause this, but it looks alright to me. What am I missing? Main.java package Main; import java.awt.Toolkit; public class Main implements Runnable { private Thread gameThread; private Game game; private boolean running = false; public static ClientFrame frame; public static Toolkit kit; public static int WIDTH = 300, HEIGHT = WIDTH*16/9, SCALE = 3; public Main() { game =

How can I create a random number of D2D shapes (rectangles and ellipses) and refer to them as an array while drawing?

余生颓废 提交于 2019-12-13 04:25:47
问题 Let me elaborate. I define a D2D Rectangle like so: D2D1_RECT_F rect1 = D2D1::RectF(5, 0, 150, 150); and an ellipse as: D2D1_ELLIPSE ellipse1 = D2D1::Ellipse(D2D1::Point2F(75.f, 75.f), 75.f, 75.f); To draw these shapes, I first transform them and pass them to the rendertarget: m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(D2D1::SizeF(200, 50))); m_pRenderTarget->FillRectangle(&rect1, m_pLinearGradientBrush); I'd like a way to create a random number of rectangles and ellipses,

Java JComponent.getGraphics() always returns null

一笑奈何 提交于 2019-12-13 04:25:14
问题 I am trying to an object that functions as a button but uses images for display. My problem is that when call getGraphics() it returns null . I have been searching allover the place and cannot find why? My code for the constructor where it dies at is... public class ImageButton extends javax.swing.JComponent implements java.awt.event.MouseListener { private static BufferedImage DEFAULTBUTTON; private BufferedImage button; private Graphics g; public ImageButton(){ //Call the constructor for

Basic paintComponent not being called by repaint()?

回眸只為那壹抹淺笑 提交于 2019-12-13 04:24:09
问题 I'm using the book Headfirst java , and I have put together a program that I thought would compile fine. But when the window is created, the background or oval isn't showing up. import javax.swing.*; import java.awt.*; public class setup { public static void main(String[] args) { JFrame f = new JFrame(); System.out.println("Created Frame"); JPanel myJPan = new JPanel(); System.out.println("Created Panel"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300,300); System.out

Extend displaying values of bar plot to multivariate stacked bar [duplicate]

大憨熊 提交于 2019-12-13 04:15:19
问题 This question already has answers here : Showing data values on stacked bar chart in ggplot2 (2 answers) Closed 4 years ago . I have been told that it is better to split up sub questions into multiple topics on SE, so here I go. I have adapted the answer in this question to be presentable in a multivariate stacked bar plot. Everything works fine, however the values are not displaying correctly. dnom <- data.frame(Variant = sample(c("iedere","elke"),size = 50,replace = TRUE), Region = sample(c

How do I make Graphics2D draw a tooltip on Mouse Hover

烂漫一生 提交于 2019-12-13 03:56:49
问题 so I have initialized each individual vertex as a JLabel and drawn the dot on the application with Graphics2D. However, I can't get a mouse listener to work with the graphic drawing for some reason. I am trying to get a tooltip to appear whenever the user has their mouse on the point (making an interractive graph). package GUI; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import javax

Java Challenge on Permitting the User to Draw A Line

£可爱£侵袭症+ 提交于 2019-12-13 03:43:45
问题 My question has been alluded to in java draw line as the mouse is moved, however, I have not advanced far enough into this book to have covered JPanels, JFrames and Points as stated by the prior programmer who asked this question. Answering this question definitely would help most beginner programmers better understand the graphics class and drawing, an often intricate process, especially for beginners. According to the text I am using (as I am learning Java on my own), this was the example

C# How can I merge two Bitmaps?

假如想象 提交于 2019-12-13 03:40:34
问题 I'm trying to find a way to merge two Bitmaps together in a Paint event. My code looks like this: private void GraphicsForm_Paint(object sender, PaintEventArgs e) { try { Bitmap1 = new Bitmap(1366, 768); Bitmap2 = new Bitmap(1366, 768); OutputBitmap = ...//and this is where I've stuck :( } catch { } } The problem is more problematic, because the Graphics object which draws onto Bitmap2 is in an other class. I also want Bitmap2 to be drawn behind Bitmap1 on the OutputBitmap. Can anyone give me