FAQ Database Discussion Community


Why is my rectangle being drawn wrong?

ios,swift,graphics,sprite-kit
I'm trying to draw a rectangle around my screen. Here's my code: let viewRect = SKShapeNode(rect: self.view!.frame) viewRect.strokeColor = SKColor.whiteColor() viewRect.lineWidth = 2.0 addChild(viewRect) I'm using self.view!.frame instead of self.frame because my scene is not the same size as my screen (the scene is stretched to fill my screen). I...

Setting multiple line colors in matlab figures simultaneously to different values

matlab,graphics,plot,matlab-figure,handle
I have a figure in MATLAB with some lines, that get automatically assigned to various colors, and I want to set the same color sequence to other figure objects. For example: x = 0:10; y = 0:0.5:5; h = plot(x,y+1, x,y+2), hold on g = plot(x,y-1, x,y-2) % want to...

GDI+ curve “overflowing”

c#,graphics,graph,gdi+
I'm currently using GDI+ to draw a line graph, and using Graphics.DrawCurve to smooth out the line. The problem is that the curve doesn't always match the points I feed it, and that makes the curve grow out of the graph frame in some points, as seen below(red is Graphics.DrawLines,...

SDL drawing program is Freezing

c++,graphics,sdl,sdl-1.2
hey guys i am not sure why my program is freezing after drawing the sixth squire it's frustrating i mean it's just the same code over and over again why is it executable the first 6 times and freeze on the 7th :/ here is my code: #include<iostream> #include<stdlib.h> #include<time.h>...

OpenGL flickering screen

c++,c,opengl,graphics,3d
I've written a simple opengl running in my ubuntu laptop. It is a small solar system including the sun and the earth, the earth rotates around the sun. The problem with my program is the screen keep blinking continuously every time I try to run it. #include <GL/glut.h> #define SUN_RADIUS...

Can i make more than one graphics console in Java?

java,graphics
I want to make a graphics based game (applet) which opens a second graphics console when a user clicks a button on the first console. Is there anyway I can do this? I tried to add the main method to the game so that I can import hsa.Console and create...

picture box crossed out C#

c#,graphics,2d,picturebox,gdi
I have a project in which I draw several rectangles using GDI. I do it using i++ from i=0 to i<=10. I use e.Graphics.FillRectangles. I refresh the drawn rectangles every 1/10s by calling Graphics.Invalidate() My problem is that my picture box gets crossed out when drawing more the 4 rectangles....

Plot multiple frames of different size on the same window

r,graphics,graph,plot
Consider this example: par(mfrow=c(2,3)) frame() image(matrix(1:100, nrow=100), main="my wide plot", axes=FALSE) frame() plot(rnorm(120), rnorm(120), main="plot 1") plot(dpois(0:20, lambda=6), type="b", main="plot 2") x = rnorm(100) y = x+runif(100, 10, 12) plot(x=x, y=y, , main="plot 3") How can I do to make my first graph (image(...) titled my wide plot) to occupy...

When designing GUI for app dev, what is the proper way to color text

android,ios,css,user-interface,graphics
I am prepping PSDs for development of an iOS and android app. For coloring text do I: 1) Use #000000 - black text - and vary opacity to achieve gray values for primary / secondary text shades? 2) Or use a 100% hex value of different shades of gray? Google...

Graphical Algorithms: Sutherland-Hodgman clipping algorithm - what happens when 2 outer vertices cross the clipping area?

algorithm,graphics
There are 4 rules explained in Sutherland-Hodgman algorithm for clipping polygons: If both vertices are inside the clipping area - save the second If the first vertex is inside and the second is outside - compute the intersection with the border of the clipping area and save it If the...

WPF image stop repainting

c#,wpf,mvvm,graphics
Using WPF and MVVM I'm trying to display camera images into a Image. Each frame camera got, a callback is called : Viewmodel public void OnNewFrame(object sender, EventArgs e) { Camera camera = sender as MyCamera; camera.ToBitmap(out _bmpImage); RaisePropertyChanged("BMPImage"); } Each frame, I update the variable _bmpImage : ViewModel private...

Android Plotting 2D Graph

java,android,user-interface,graphics,graph
I am developing one app and I want to show 2D (x-y coordinates) graph, in my activity. I have looked on internet there are lots of third party libs capable of drawing graphs. But I am looking for android built in lib or widget, which will draw graph. Also is...

Why does this work? (Java, Graphics object)

java,text,graphics,instance,antialiasing
Here's my code: public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.drawString("This is my string", 200, 200); } This works correctly; the text comes out as anti-aliased. However, why does it work? The text is drawn by the g object, however as far as I can...

Weighted, blended order independent transparency

opengl,graphics,shader,transparency
I want to use Meshkin method described here http://jcgt.org/published/0002/02/09/paper-lowres.pdf page 5 in order to obtain a basic weighted, blended order independent transparency. I don't understand who is Ci and ai. Also, what is "Multiple render targets"....

Weird output for Graphics code

java,swing,graphics,awt
I am attempting to make a Connect Four game to improve my ability with Java Graphics and as a school project. The background for the game will be a blue JPanel and the game board will be a separate JPanel that will be placed on top of the background. See...

Relationship between AFX_WM_DRAW2D and WM_PAINT in MFC Application

c++,graphics,mfc,directx,direct2d
What is the relationship between the two messages in the subject? When exactly the AFX_WM_DRAW2D is passed to application queue. I am asking because I have encountered the strangest recursive call of AFX_WM_DRAW2D handler. Whenever I am trying to paint something inside the AFX_WM_DRAW2Din compatibe render target the handler is...

Buttons and paint method

java,swing,graphics,jbutton,actionlistener
I'm having trouble with my buttons. I know they're working because I've tested them out by exiting the problem through System.exit. Here is what my output looks like: http://imgur.com/Ks7mIFa When I click the close button, the handle on the switch should redraw to the other side and the close button...

Incorrectly drawn octagon (random) - NEW TEST ADDED

python,opengl,graphics,polygon,pyglet
I'm trying to draw an octagon with Python 3.4 and Pyglet 1.2, which uses OpenGL. My code seems to be correct but the drawing sometimes has additional triangle of random color (white or black most of the time) at random position (0, 0 (bottom left) corner most of the time)...

How to upscale and render remote(RGB565) frame buffer on Android native?

android,graphics,android-ndk,android-gui,surfaceflinger
I have ported remote frame buffer receive C code on Android 4.2.2 which receives frame buffer from host in RGB565 format. Able to render the received framebuffer following the standard android example frameworks/native/services/surfaceflinger/tests/resize/resize.cpp. Following is the code snippet used sp<Surface> surface = client->createSurface(String8("resize"), 800, 480, PIXEL_FORMAT_RGB_565, 0); SurfaceComposerClient::openGlobalTransaction(); surface->setLayer(100000); SurfaceComposerClient::closeGlobalTransaction();...

Mathematica Dynamic List Design [closed]

dynamic,graphics,slider,wolfram-mathematica,list-manipulation
Suppose a dynamic list of 5 that if one changes, all the others would change correspondingly to keep the sum 1. It comes from a practical problem that 5 probabilities of a total of 1, if one of them changes (by Slider), all the others will also change in an...

Errors trying to add rectangles to JPanel

java,swing,debugging,graphics
I am trying to draw a grid of rectangles on a JPanel that already has a few JButtons on it. I get a big list of errors when I try to run it. Here's my code: package GameOfLife; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*;...

What's the use of lightmap?

graphics,unity3d,3d,game-engine
For starter, I know what a lightmap is, what to be gained by using it, and how to implement it. What I don't get is, if you have dynamically moving objects, which won't be able to generate a lightmap, you still need a light source to project their shadows. So,...

Simultaneous Rotate and Translate not working as expected in javafx

graphics,javafx,javafx-8,drag
I have built the following "system" from Circles and a Line. I am trying to implement just following two transitions in the system. When the Green Circle is dragged, both the Green and Blue circle should rotate about the Red center, in the direction of drag. When the Red center...

Java graphics - repaint an image without removing another

java,image,swing,graphics,repaint
I am using Graphics g to draw an image for my player and a map. Whenever the player moves I want to update the player image to the new location without updating the map image. How can I do this? Thanks in advance for any replies! Sorry about my messy...

Interactive bend image

css3,graphics,html5-canvas
I'd like to transform image in web browser this way -> more precisely, it should be 3D effect (like wrap the image around can). I'm considering these options: CSS3 transform (is it possible with matrix3d somehow?) HTML5 canvas (I don't have any experience here yet) applet or flash (this would...

How to paint over a JPanel?

java,swing,graphics,nullpointerexception,jpanel
I (A novice programmer) am trying to paint an oval over a JPanel. I am trying to use the method paint. However, it requires a Graphics argument. I get a NullPointerException when I include my Graphics as a argument because it is null, but I do not know how else...

Fill width of panel with rectangles(variable size)

c#,.net,graphics
I'm making a sorting algorithm vizualizer(Like Sound of Sorting without the Sound) But i stumbled upon a problem, and i can't seem to figure it out. I need to layout rectangles over the width of a panel(variable amount). Image of the bars: But when i get more bars, sometimes i...

Vertical lines in plot_fit graphic of python ststsmodels package

python,graphics,statsmodels
What are vertical lines in python stats-models plot_fit graphic as discussed here: LINK. Plot output : ...

How to get high frame rate while using putpixel() in C?

c,performance,graphics,pixels,bgi
I was working with a code to print pixels. //C code #include<graphics.h> #include<conio.h> int main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); for (int i=0;i<100;i++) { for(j=0;j<200;j++) { putpixel(i, j, GREEN); } } getch(); closegraph(); return 0; } Is there any way of achieving faster response from C...

scale in java not working for (-1,1) or (1,-1)

java,graphics
I am trying to make a simple reflection of word "good": So i scale the text good by y axis using g2d.scale(1,-1) but nothing. I am using this simple code: @SuppressWarnings("serial") public class C extends JPanel{ JFrame frame = new JFrame(); public C(){ frame.setSize(500,500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(this); frame.setVisible(true); } public void...

Multiple WebGL models on the same page

graphics,three.js,webgl
My research lab is working on a webpage that displays a long scrollable list of 3d models, about 50 or so. Our first idea was to do this with separate THREE.js WebGL contexts, but it seems this isn't advisable given the architecture of WebGL, and browsers seem to limit the...

What does the terms Sampling,Scanline Mean in Raster Graphics(Bresenham's Algorithm)

algorithm,graphics,raster,vector-graphics
Im a novice when it comes to computer graphics.Im trying to learn Bresenham's Scanline algorithm. It says Pixels positions along a Line are determined by sampling at unit X intervals What exactly does this sampling mean,in layman's terms. Then it says Plot the pixel whose scan line value is closest...

What is the word for colorizing grayscale bitmap

algorithm,graphics,colors,bitmap
I have a task of converting grayscale (8 bit, 256 levels of gray) bitmap to a colored one, with the function that looks somewhat like this: function colorize(bmp, colorA, colorB) In the end black pixels become colorA, and black pixels become colorB, and grayscale pixels a mix of A and...

Transform rhombus defined by corners to another rhombus

graphics,transform
If you have a 2D model in the shape of a rhombus, defined by it's four corners, and you want to transform it into the shape of another rhombus, given it's 4 corners, how would you do this? Can you do it with a transformation matrix? My line of thinking...

Blurring in PyGame

python,graphics,pygame,2d
I'm working on a short intro in PyGame, and I need to blur some static lines. After two days of searching, I can't find anything. Does PyGame have a built-in method to blur a shape or surface? Will I need to do it manually? What would be the best way...

C# Win.Form - graphics disappear after load

c#,winforms,graphics,user-controls,drawing
I'm drawing on a User Control to show the time between two dates. My problem is when the applications starts running or every time I Refresh() the User Control all graphics disappears until the Form is resized. Observing how the Form behaves when it refreshes, the User Control is shown...

C++ GUI Challenge

c++,graphics,programming-languages,monogame
Recently I was challenged by a friend to create a snake game much like the classic Nokia version using the C++ language. I have been programming in Java, but unlike Java, C++ doesn't seem to have standard gui libraries. Therefore after looking into GUI for C++ many different api are...

Applying rotation to Graphics object

graphics
I have very little experience programming with graphics objects. I am currently tasked with exporting a document (.tiff image) with redacted annotations. The redacted annotation is just a black rectangle object. I am able to get the x coordinates, y coordinates, width and height properties through the .XMP data. There...

Can the OpenGL 'deprecated' functions possibly be unsupported?

c++,c,opengl,graphics,deprecated
I am testing with glDrawPixels to port my simple pixel-drawn 2D game from Windows API to OpenGL with GLFW. It runs nicely with FPS over 100, additionally cross-platform. Just one thing that is slightly annoying me is that I'm using a deprecated feature. I don't see any problems now, but...

Update window display OpenGL/GLUT C++

c++,events,opengl,graphics,glut
I have a method and I need this method to show the behavior of a virus in a network using GLUT (this is my first time using a graphics library). I am displaying a number of points and lines that connect them. The program runs fine and it shows the...

Plot: Add legend that overlay several Frames

r,graphics,graph,plot
How can we write a legend that overlay several frames? Using the xpd parameter, the legend can exit its frame but still cannot enter the next frame. par(mfrow=c(1,2)) plot(rnorm(120), rnorm(120)) legend(x = -0.1, y=0.1, legend = "Legend that covers both plots", text.col="red", cex=2, box.col="red", xpd=TRUE) plot(rnorm(120), rnorm(120)) One dummy solution...

How can I convert PNG to GIF keeping the transparency?

delphi,graphics,png,gif
How can I convert PNG to GIF keeping the transparency? I would have hoped that using the Assign( ) method would work but it doesn't seem to migrate transparency. In the GIF, it's represented as black. png:=TPngImage.Create; try png.LoadFromFile(sFile); // comes from file: png.TransparencyMode; // comes from file: png.Transparent //...

Android Graphics Libraries, creating a message box

android,graphics,libraries
What I want to do is simple. I want to be able to draw a message box to the screen that wraps the height of the box to the size of the text within it. I am using android's canvas objects to do this, but I do not know how...

How to paint permanently on JComponent

java,swing,arraylist,graphics,shape
I'm trying to create a paint application in Java. I have a "canvas" class which extends JComponent. I have an ArrayList of type Shape which holds all the shapes of the entire drawing. Inside the paintComponent() method: Each loop everything gets cleared Every Shape inside the ArrayList gets painted with...

Spawning mutiple circles and make them move

java,graphics,applet
I'm trying to teach myself java and I "try" to code a little game. I have a problem and I guess the solution is very simple but I'm struggling. The basic idea is that I am controlling a circle and I want to spawn circles every 5 seconds at random...

Why am I getting a QWidget error?

python,graphics,drawing,pyqt4
I have recently found this person's code that I could possibly be able to use for my project but I'm still pretty new to Python so I'm having a really rough time understanding the code and the error that keeps occurring even though the code is exactly the same as...

Java- Key Bindings not working / actionPerformed not being called

java,swing,graphics,user-input,key-bindings
I finally learned how to get graphics to work in java thanks to the guy who helped me on my previous question, but now I can't get key bindings to work. I know that the graphics method is called as I need it to, and I think that I have...

Where is 'webgl.osmesalib' parameter?

firefox,graphics,webgl
I'm trying to get webgl running on my firefox (v37.0.2) via software acceleration with mesa. I tried following the steps that have been stated in this article: http://www.binarytides.com/enable-webgl-firefox-ubuntu/ However, I am unable to find any parameter named 'webgl.osmesalib' in about:config section? Has this been removed (or renamed)? If yes, then...

Pinhole camera projection matrix explained

math,graphics,camera,projection
I'm trying to solve the attached question after reading some material about pinhole cameras and how their projection matrix are set and I'm still not sure I understand all the math. in the attached question, when moving the COP of the camera to -2Zp as I understand I basically increase...

Rotate a point around another causes the distance between the two to shorten after eeach iteration

android,graphics
As the title specifies, after each iteration the distance between the two points shortens. (I need the x, y to be ints ant the end) Thank you ! public void updatePlayerFlip() { double angle_stepsize = 0.1; double angleInRadians = angle_stepsize * (Math.PI / 180); double cosTheta = Math.cos(angleInRadians); double sinTheta...

Rotate gauge needle in C#

c#,wpf,graphics,.net-4.5
I cannot rotate the needle properly around its center without clipping occurring. The code I have found for rotation that doesn't result in clipping rotates the needle the wrong way. I found the code samples somewhere from stackoverflow. Pic1 : correct position pointing south Pic2 : RotateBitmap4(), rotation at wrong...

Background image dimension for Navigation Drawer header

android,graphics,navigation-drawer,material-design
Basically I liked the background used by Mr. Jonathan Lee for Navigation Drawer header back ground in google official link http://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-content So, I wanted to reproduce something similar inspired by that. I believe I need to make similar design in photoshop and set as background. But the question is, what...

Add white rectangle above a screenshot in a Graphics object (java) [duplicate]

java,graphics,draw
This question already has an answer here: How to add text to an image in java? 1 answer I've got a method that's supposed to add some text to screenshots. The screenshot is fed into this method as a File object like this: private void modifyScreenshot(File file) throws Exception...

Java graphics being drawn on top of existing graphic

java,image,graphics
Main class: public Main() { Frame f = new Frame(); final Panel p = f.p; final Player player = new Player(); Timer t = new Timer(UPDATE_PERIOD, new ActionListener() { public void actionPerformed(ActionEvent e) { Graphics g = p.getGraphics(); p.render(g); player.tick(); player.render(g); g.dispose(); } }); t.start(); } Player render method: public...

How can I declare a circle as a variable? [closed]

java,variables,graphics,circle
So I'm trying to make a class where I run the java applet and then a garage band like drumset pops up where I can then click the different drums in order to make different sounds. I have the drums set to different circles that I created and I am...

Creating new shape palettes in ggplot2 and other R graphics

r,graphics,ggplot2
I'd like to specify my own shape palettes for ggplot2 at least as a vector for input into scale_shape_manual. I really like the paired shapes palette from JMP, but noticed R doesn't have some of these shapes. In particular, sideways triangles (e.g. |> or <|) or a filled upside down...

Extracting vector graphics (lines and points) with pdfclown

vector,graphics,pdfclown
I want to extract vector graphics (lines and points) out of a pdf with pdfclown. I have tried to wrap my head around the graphics sample but i cannot figure out how the object model works for this. Please can anyone explain the relationships?

Calculating the perspective projection matrix according to the view plane

opengl,math,graphics,projection
I'm working with openGL but this is basically a math question. I'm trying to calculate the projection matrix, I have a point on the view plane R(x,y,z) and the Normal vector of that plane N(n1,n2,n3). I also know that the eye is at (0,0,0) which I guess in technical terms...

How to implement .png pics in a JFrame?

java,graphics,jframe,awt
What I want to do is making a window, a GUI, and putting an image in it. I watched a YT tutorial (https://www.youtube.com/watch?v=Ap20Qw77TzY) and copied everything similar but the Window I make has no image at all. I tried different file types like .jpg and different window sizes, matching he...

Can't Get ImageIcon to Display

java,swing,graphics,jframe,imageicon
I've looked at a ton of other questions where people have similar issues to what I'm having here (most solutions found by simple mistakes) but I can't for the life of me figure out why my graphics won't display in my jframe. I'm pretty new to Java Graphics so I'd...

Java Unicode character displaying box instead of Runic letter

java,string,unicode,graphics
I am trying to draw random Nordic runes in a little Java game, but all I'm getting back is a square character. public class MyComponent extends JComponent { public void paintComponent(Graphics g) { String s = "\u16A8"; g.drawString(s,50,50); } } What the character should be displaying: https://en.wikipedia.org/wiki/Ansuz_(rune) What it's actually...

DirectX 9 projection matrix infinite element?

c++,graphics,3d,directx-9
I've been banging my head on doing transformations in DirectX 9 and during debugging I finally noticed a problem, when calling D3DXMatrixPerspectiveFovLH(&projection, D3DX_PI/4, yRes/xRes, 1, 100); the first element (_11) of projection is #INF, which I'm pretty sure it should not be. This is directly after declaring this matrix and...

how to refresh JFrame after after adding java 2d components

java,swing,graphics,graphics2d
in this code i added two components to the jframe and also used revalidate and repaint but only one of the components is being viewed. i need a way to refresh the jframe class A extends JPanel{ int i ,j; A(int i,int j){ this.i = i; this.j = j; }...

Getting the font metrics before the paint method id called

java,animation,graphics,fontmetrics
Hi I am creating a news ticker/ text scroller. I am using the following method: import java.awt.Color; import java.awt.FontMetrics; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Scroll1 extends JPanel{ private int x; private int x2; private int y; private String text; final int startX=-100; public Scroll1(int startX) { x2=-650;...

Transfering between 2d coordinate systems where the x and y axes aren't perpendicular

math,vector,graphics
my question is more of a mathematical question in 2d computer graphics, but I figured that its more relevant here than the standard Stack overflow, if there's one dedicated especially to computer graphics by all means you can move this there. Anyway my question is about transferring from 2 different...

Swift - UIGraphics dash line close

swift,graphics,line,dash
This is my code: UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.view.frame.width,graphSize), false, 0) let context = UIGraphicsGetCurrentContext() CGContextSetStrokeColorWithColor(context, UIColor.whiteColor().CGColor) CGContextSetLineWidth(context, 0.3) CGContextBeginPath(context) CGContextMoveToPoint(context, width1, height1) CGContextAddLineToPoint(context, width11, height11) CGContextMoveToPoint(context, width2, height2) CGContextAddLineToPoint(context, width22, height22) //dash line CGContextStrokePath(context)...

How to apply flat shading to RGB colors?

graphics,colors,3d,rgb
I am creating a small 3d rendering application. I decided to use simple flat shading for my triangles - just calculate the cosine of angle between face normal and light source and scale light intensity by it. But I'm not sure about how exactly should I apply that shading coefficient...

How to prevent the JPanel from being updated?

java,swing,graphics,jpanel
I'm creating a sort of paint application. The user can move a circle in a JPanel by pressing/dragging the mouse. I have a JCheckBoxMenuItem in one of my JMenus: JCheckBoxMenuItem checkitem = new JCheckBoxMenuItem("Draw mode",false); When it is not activated, the circle can only be moved (by dragging/pressing) and the...

Transparent RichTextBox with Graphic not showing Text

c#,winforms,graphics,transparency,richtextbox
I have the following code working, and commented out the Text being drawn onto the control as I started out using this as a graphic only control. Moving on, I have switched the control to be RichTextBox instead of Control so that I can have all the goodies that come...

Moving a graphics 2d object with threads

java,multithreading,swing,graphics
I am not quite sure why my boat is not moving. If anyone could explain in detail that would be great. This is what creates and shows the boat: import java.awt.Color; import java.awt.Graphics; import javax.swing.JApplet; @SuppressWarnings("serial") public class boatApplet extends JApplet{ public void paint(Graphics g) { setBackground(Color.blue); // Xposition, YPosition,...

Basic Specular Shading

c++,graphics,3d
I am playing around with a simple code that generates a shaded sphere. I don't yet fully understand the math but I am figuring it out as I play with the code. I was wondering how one might implement specular shading into this based on this code. Any suggestions? for...

Graphics not displaying on JFrame

java,swing,graphics,graphics2d
I'm am new to graphics in java and for some reason the graphics are not displaying on the jframe. I am confused of how to set up and instantiate the graphics. There could also be a stupid error in the code that im just not seeing. Thanks for any feedback!...

Rotating an Image object

java,image,graphics,rotation,bufferedimage
I have a method getImage() that needs to rotate an Image, store it in a new variable, then return that new Image. Here is my attempt, the image appears to be empty or something. It just does not show up on the screen: public Image getImage() { buffImage.createGraphics().rotate(direction); return buffImage;...

How to reduce OpenGL CPU usage and/or how to use OpenGL properly

c++,opengl,graphics,cpu
I'm working a on a Micromouse simulation application built with OpenGL, and I have a hunch that I'm not doing things properly. In particular, I'm suspicious about the way I am getting my (mostly static) graphics to refresh at a close-to-constant framerate (60 FPS). My approach is as follows: 1)...

Format point value in hightcharts

javascript,jquery,graphics,highcharts,percentage
I have a graph with 2 line series. Points in each series are percent but I get them from the database in this format : 0.24 for 24% , 0.02 for 2% ... Is there any method for multiply the value by 100 directly in my graph options ? I...

Smooth passage from one graph to another

r,graphics,graph
Consider the two following graphs require(ggplot2) set.seed(5276) my_mtcars = mtcars my_mtcars$rand = rnorm(nrow(mtcars)) ggplot(my_mtcars, aes(rand, mpg)) + geom_point() ggplot(my_mtcars, aes(wt, mpg)) + geom_point() I would like to make a movie (or any animated picture that could easily be introduced in a .ppt) that would make a smooth passage from the...

Drawing circles in 2d grid array in java

java,swing,graphics
I understand how to make 2d array grid. I experimented to put random numbers in it but i do not know how to draw them on jframe. For instance, 0 for red circle , 1 for green circle and so on. I need to figure out how represent them in...

Make JLabel background transparent in a frame with background [closed]

java,swing,graphics,transparency,jlabel
I have a JLabel on my JFrame and a JFrame with a picture background. The problem is although my JLabel is opaque but it still has a grey background which is annoying. Here is my code: import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField;...

Reflecting text in java

java,graphics
I am trying to make a digital clock in this way: As shown in the image 1 i want the clock to be reflected. image 1 made in blender What i have tried: I tried using java (Graphics2D)g by rotating the string and the using substring but i got this...

How to perform same action as changing Windows 7 display from Landscape to Portrait

c++,c,winapi,graphics,windows-7
I need to write a program which programmatically changes the Landscape mode to Portrait of a touchscreen in Windows 7. The resolution is 1920 x 1080 and I thought I could switch the 1920 with the 1080 and use ChangeDisplaySettings or ChangeDisplaySettingsEx to make the change. but it doesn't work....

R - Generate a 2x2 panel with four plots created from list

r,list,graphics,plot
I have a list with four data frames that I use to create plots in a lapply function. The plots are created individually, however I would like to organize them in a 2x2 panel like this sample: This is the code I am using: # create letters for legend leg...

What is the JPanel/Graphics method paintComponent?

java,swing,inheritance,graphics
So I'm trying to learn Java graphics and this bit of code has me perplexed. I don't understand a couple things here: Why is paintComponenet used twice for the name of the method and as we call a method from super (JPanel)? What is Graphics g, isn't it just a...

How to make a Javafx Image Crop App

java,image,canvas,graphics,javafx
I am building an application for my colleagues to crop image. I use FXML with Scene Builder to build the GUI. The user click a button to choose a image from his computer. Then, the image is shown in the GUI. User can zoom and move in the pane. At...

How to draw string in GDI+ Graphics.DrawString that honors the underline chars when I use ampersand?

delphi,graphics,gdi+,drawstring,drawtext
I'm using GDI+ to draw a string but it does not act like windows DrawText when it comes to honoring the & in front of the a char. It just draws & and not underlines next char. Maybe there is an option to turn it on/off? Please help.

ACM Polygon No Border?

java,graphics,acm
I'm a newbie to Java!!! :) Right now, I'm just perplexed about the ACM library's objects and it's functions. I want to create a GRect with a color of green. So I would probably do this: GRect rect = new GRect(0, 0, 50, 50); rect.setFilledColor(Color.GREEN); rect.setFilled(true); add(rect); But my problem...

Animation not adding to JFrame

java,swing,graphics
I'm new to java swing, so forgive me if my mistake is extremely obvious. What my code is supposed to do here is create one JFrame and animate two boxes moving upwards through the frame side by side. However, I'm seeing only one box (the blue box created by the...

Spotlight with shadows becomes square-like

c++,opengl,graphics,shader,shadow
I've been following a two part tutorial on shadow mapping from OGLDev (part 1, part 2) for a couple of days now, and I've nearly finished implementing it. My problem is that when I enable shadow maps the illuminated region which shadows appear in appears as a "strip" and I'm...

AttributeError: '_Screen' object has no attribute 'mainloop'

python,python-2.7,graphics,turtle-graphics
I'm designing a simple Python program that uses the Turtle graphics module to draw lines on the screen with the arrow keys. import turtle turtle.setup(400,500) # Determine the window size wn = turtle.Screen() # Get a reference to the window wn.title("Handling keypresses!") # Change the window title wn.bgcolor("lightgreen") # Set...

Java JFrame Graphics Update

java,swing,graphics
I am playing around with graphics in Java using JFrames and am trying to completely understand when Graphics changes actually occur. Let's say I have a timer running every second, and every second the graphics change. The tick method, for example, will run every second... public void tick(Graphics g) {...

How to test graphical output of functions?

r,testing,graphics,plot,testthat
I am wondering how to test functions that produce graphics. I have a simple plotting function img: img <- function() { plot(1:10) } In my package I like to create a unit test for this function using testthat. Because plot and its friends in base graphics just return NULL a...

How to create an indent in shaped control that allows painting on indented region?

c#,graphics,shape
I have a custom control, which I am applying a shape to. The shape has a pointer (similar to the message indicator in Skype that shows if the message was a received message, or a sent message) that is on the left or right side. When the indicator is on...

Gnuplot - Graphic appears and disappears when zooming

graphics,gnuplot
I'm trying to plot some graphics in gnuplot, and I find out that canvas doesn't show the whole curve. It shows different graphics for different zooms. What could I do to solve this?...

Why is Java Graphics not painting?

java,graphics
I'm a bit new to programming right now and am trying to make Pong in java. However I'm not able to make any graphics show up. Main Class public class Pong1 { public static Frame frame = new Frame(); public static Panel panel = new Panel(); public static void main(String[]...

Flood fill difficulty in C graphics

c,graphics,flood-fill,turbo-c
(Note: My college is making me study graphics in ancient Turbo C) Anyway I am using the inbuilt algorithm for floodfill to color a well and a bucket. The problem I am facing is that the compiler fills the region upto a boundary color. However I would like to fill...

Allocating a new buffer per each frame to prevent screen tearing

c++,c,opengl,graphics,sdl
When I use the SDL library to set the pixel values in the memory and update the screen, screen tearing occurs whenever the update is too fast. I don't know much about the SDL internals, but my understanding from what I see is that: The update function returns right after...

Passing control of a drawing window “deeper” into a program?

c++,design,graphics,sfml
I am using SFML 2.3 to control the graphics in my program. I need a class to be able to access the window, to draw to it even if that class was not the one that originally created the window (does not have ownership). E.g. the Battle class needs to...

Why my image doesn't load on contentPane except on CENTER?

java,swing,graphics,layout-manager,border-layout
I am currently still learning Java GUI and stumped on this problem. I just wonder why can't i load it anywhere except on center and how do i load my image anywhere else? import java.awt.*; import javax.swing.*; public class GUI { public static void main(String[] args) { GUI gui =...

How colorize Circles in a plot in MATLAB?

matlab,graphics,plot,matlab-figure
I have a MATLAB code as follows: MinVal = -1; MaxVal = 1; MaxRadius = 0.5; nCircles = 5; Dimension = 2; Circles = zeros(nCircles, Dimension); Radius = zeros(nCircles, 1); for i = 1 : nCircles Circles(i,:) = unifrnd(MinVal, MaxVal, [1, Dimension]); Radius(i) = unifrnd(0, MaxRadius, 1); end t =...

Creating A Cube Using Only CSS Gradients

html,css,graphics,3d,cube
I've tried numerous ways using linear-gradients to create several stripes layered on top of each other and have gotten very close but seem to be stuck on the top face. I'm trying to accomplish this using gradients be it linear or radial so that I can eventually upgrade them to...

Using jfreechart, how would I change the color and style of the series

java,graphics,jfreechart
I'm a beginner programmer. This is my project for school. A lot the jfreechart implementation code is not my specific code, but it was taken other tutorials. import java.awt.BasicStroke; import java.awt.Color; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import...