Questions tagged [graphics]

Graphics are visual presentations. Questions using this tag should also be tagged with the appropriate language and graphics subsystem in use. For more general graphics questions, consider Computer Graphics Stack Exchange (computergraphics.stackexchange.com).

Filter by
Sorted by
Tagged with
614 votes
42 answers
445k views

How can I determine whether a 2D Point is within a Polygon?

I'm trying to create a fast 2D point inside polygon algorithm, for use in hit-testing (e.g. Polygon.contains(p:Point)). Suggestions for effective techniques would be appreciated.
Scott Evernden's user avatar
399 votes
26 answers
306k views

Creating a blurring overlay view

In the Music app of the new iOS, we can see an album cover behind a view that blurs it. How can something like that be accomplished? I've read the documentation, but did not find anything there.
kondratyevdev's user avatar
324 votes
13 answers
1.1m views

How do I position one image on top of another in HTML?

I'm a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with a red square in the upper ...
rrichter's user avatar
  • 9,353
279 votes
15 answers
208k views

Ball to Ball Collision - Detection and Handling

With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator. You click and drag the mouse to launch a ball. It will bounce around and eventually stop on the &...
231 votes
4 answers
138k views

GraphViz - How to connect subgraphs?

In the DOT language for GraphViz, I'm trying to represent a dependency diagram. I need to be able to have nodes inside a container and to be able to make nodes and/or containers dependent on other ...
Winston Smith's user avatar
226 votes
7 answers
121k views

Difference between SurfaceView and View?

When is it necessary, or better to use a SurfaceView instead of a View?
Viktor's user avatar
  • 3,305
219 votes
12 answers
130k views

How can I produce an effect similar to the iOS 7 blur view?

I'm trying to replicate this blurred background from Apple's publicly released iOS 7 example screen: This question suggests applying a CI filter to the contents below, but that's a whole different ...
Snowman's user avatar
  • 31.7k
191 votes
13 answers
485k views

How to read the RGB value of a given pixel in Python?

If I open an image with open("image.jpg"), how can I get the RGB values of a pixel assuming I have the coordinates of the pixel? Then, how can I do the reverse of this? Starting with a blank graphic, ...
Josh Hunt's user avatar
  • 14.4k
186 votes
6 answers
386k views

Saving images in Python at a very high quality

How can I save Python plots at very high quality? That is, when I keep zooming in on the object saved in a PDF file, why isn't there any blurring? Also, what would be the best mode to save it in? png, ...
dustin's user avatar
  • 4,386
183 votes
15 answers
27k views

Most underused data visualization [closed]

Histograms and scatterplots are great methods of visualizing data and the relationship between variables, but recently I have been wondering about what visualization techniques I am missing. What do ...
177 votes
3 answers
218k views

How can I extract a good quality JPEG image from a video file with ffmpeg?

Currently I am using this command to extract the images: ffmpeg -i input.mp4 output_%03d.jpeg But how can I improve the JPEG image quality?
Daniel Gartmann's user avatar
161 votes
8 answers
123k views

Measuring text height to be drawn on Canvas ( Android )

Any straight forward way to measure the height of text? The way I am doing it now is by using Paint's measureText() to get the width, then by trial and error finding a value to get an approximate ...
Danedo's user avatar
  • 2,243
161 votes
6 answers
156k views

How to make graphics with transparent background in R using ggplot2?

I need to output ggplot2 graphics from R to PNG files with transparent background. Everything is ok with basic R graphics, but no transparency with ggplot2: d <- rnorm(100) #generating random data ...
Yuriy Petrovskiy's user avatar
160 votes
2 answers
65k views

What does PorterDuff.Mode mean in android graphics.What does it do?

I would like to know what PorterDuff.Mode means in android graphics. I know that it is a transfer mode. I also know, that it has attributes such as DST_IN, Multiply etc.
rogerstone's user avatar
  • 7,611
158 votes
22 answers
187k views

How do I get the height and width of the Android Navigation Bar programmatically?

The black navigation bar on the bottom of the screen is not easily removable in Android. It has been part of Android since 3.0 as a replacement for hardware buttons. Here is a picture: How can I get ...
Kevik's user avatar
  • 9,261
158 votes
4 answers
179k views

How to use Greek symbols in ggplot2?

My categories need to be named with Greek letters. I am using ggplot2, and it works beautifully with the data. Unfortunately I cannot figure out how to put those greek symbols on the x axis (at the ...
Sam's user avatar
  • 8,062
148 votes
19 answers
96k views

Generate colors between red and green for a power meter?

I'm writing a Java game and I want to implement a power meter for how hard you are going to shoot something. I need to write a function that takes a int between 0 - 100, and based on how high that ...
mmcdole's user avatar
  • 92.2k
148 votes
20 answers
102k views

Algorithm to detect intersection of two rectangles?

I'm looking for an algorithm to detect if two rectangles intersect (one at an arbitrary angle, the other with only vertical/horizontal lines). Testing if a corner of one is in the other ALMOST works. ...
user20493's user avatar
  • 5,774
146 votes
6 answers
99k views

What does glLoadIdentity() do in OpenGL?

I'm new to OpenGL and I'm a little overwhelmed with all of the random functions that I have in my code. They work and I know when to use them, but I don't know why I need them or what they actually do....
Alexander's user avatar
  • 3,047
133 votes
2 answers
47k views

What are the practical differences when working with colors in a linear vs. a non-linear RGB space?

What is the basic property of a linear RGB space and what is the fundamental property of a non-linear one? When talking about the values inside each channel in those 8 (or more) bits, what changes? ...
Ken's user avatar
  • 2,175
130 votes
15 answers
113k views

Pretty graphs and charts in Python [closed]

What are the available libraries for creating pretty charts and graphs in a Python application?
sverrejoh's user avatar
  • 16.7k
127 votes
4 answers
125k views

Remove facet_wrap labels completely

I'd like to remove the labels for the facets completely to create a sort of sparkline effect, as for the audience the labels are irrelevant, the best I can come up with is: library(MASS) library(...
Sean's user avatar
  • 3,885
126 votes
6 answers
210k views

Android: Background Image Size (in Pixel) which Support All Devices

I am creating an Application which will run on all Android Devices. I want to create xhdpi Graphics for My App. My App is full screen. I am confused in Creating graphics. can any one tell me the best ...
Ahmed Nawaz's user avatar
  • 1,271
126 votes
9 answers
83k views

opengl: glFlush() vs. glFinish()

I'm having trouble distinguishing the practical difference between calling glFlush() and glFinish(). The docs say that glFlush() and glFinish() will push all buffered operations to OpenGL so that one ...
jay.lee's user avatar
  • 19.6k
123 votes
8 answers
266k views

How can I set the matplotlib 'backend'?

I am new user of matplotlib, my platform is Ubuntu 10.04 Python 2.6.5 This is my code import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.plot([1,2,3]) The error is: /usr/...
user504909's user avatar
  • 9,309
121 votes
19 answers
107k views

How to crop circular area from bitmap in Android

I have a bitmap and I want to crop a circular region from this bitmap. All pixels outside the circle should be transparent. How can I do this?
Altaf's user avatar
  • 5,170
109 votes
6 answers
168k views

Can I run CUDA on Intel's integrated graphics processor?

I have a very simple Toshiba Laptop with i3 processor. Also, I do not have any expensive graphics card. In the display settings, I see Intel(HD) Graphics as display adapter. I am planning to learn ...
Ankit's user avatar
  • 6,872
108 votes
4 answers
47k views

Difference between surface and texture (SDL / general)

Can anyone explain to me in simple words what is the difference between texture and surface? I saw it used in SDL2 as SDL_Surface and SDL_Texture. SDL_Textureis created from SDL_Surface which in turn ...
ps-aux's user avatar
  • 11.9k
103 votes
6 answers
126k views

How to set shape's opacity?

I already know how to set the opacity of the background image but I need to set the opacity of my shape object. In my Android app, I have it like this: and I want to make this black area a bit ...
lomza's user avatar
  • 9,570
99 votes
6 answers
18k views

An algorithm to space out overlapping rectangles?

This problem actually deals with roll-overs, I'll just generalized below as such: I have a 2D view, and I have a number of rectangles within an area on the screen. How do I spread out those boxes ...
Extrakun's user avatar
  • 19.2k
91 votes
2 answers
179k views

Java2D: Increase the line width

I want to increase the Line2D width. I could not find any method to do that. Do I need to actually make a small rectangle for this purpose?
Boolean's user avatar
  • 14.5k
91 votes
6 answers
97k views

What are Vertex and Pixel shaders?

What are Vertex and Pixel shaders? What is the difference between them? Which one is the best?
90 votes
8 answers
103k views

Fast rectangle to rectangle intersection

What's a fast way to test if 2 rectangles are intersecting? A search on the internet came up with this one-liner (WOOT!), but I don't understand how to write it in Javascript, it seems to be written ...
Robin Rodricks's user avatar
86 votes
5 answers
48k views

How to make text glow?

Can we apply glowing effect to any text like shown below: Updated: Please also tell me what things i need to create something like this: Do i need a Special font for this?
Farhan's user avatar
  • 13.3k
85 votes
7 answers
142k views

Do not want scientific notation on plot axis

I regularly do all kinds of scatter plots in R using the plot command. Sometimes both, sometimes only one of the plot axes is labelled in scientific notation. I do not understand when R makes the ...
user avatar
84 votes
6 answers
407k views

How can I do GUI programming in C? [closed]

I want to do Graphics programming in C. I had searched a lot about the compiler that provides a rich set of functions for doing GUI programming in C, but I couldn't find anything. Basically I want to ...
Algorithmist's user avatar
  • 6,685
82 votes
13 answers
127k views

Creating SVG graphics using Javascript?

How can I create SVG graphics using JavaScript? Do all browsers support SVG?
user123757's user avatar
81 votes
3 answers
185k views

Scaling a System.Drawing.Bitmap to a given size while maintaining aspect ratio

I want to scale a System.Drawing.Bitmap to at least less than some fixed width and height. This is to generate thumbnails for an image gallery on a website, so I want to keep the aspect ratio the same....
Michael J. Gray's user avatar
76 votes
10 answers
181k views

How to convert a 3D point into 2D perspective projection?

I am currently working with using Bezier curves and surfaces to draw the famous Utah teapot. Using Bezier patches of 16 control points, I have been able to draw the teapot and display it using a '...
Zachary Wright's user avatar
73 votes
6 answers
146k views

Center text output from Graphics.DrawString()

I'm using the .NETCF (Windows Mobile) Graphics class and the DrawString() method to render a single character to the screen. The problem is that I can't seem to get it centred properly. No matter ...
Adam Haile's user avatar
  • 31.1k
71 votes
12 answers
36k views

Millions of 3D points: How to find the 10 of them closest to a given point?

A point in 3-d is defined by (x,y,z). Distance d between any two points (X,Y,Z) and (x,y,z) is d= Sqrt[(X-x)^2 + (Y-y)^2 + (Z-z)^2]. Now there are a million entries in a file, each entry is some point ...
Kazoom's user avatar
  • 5,739
71 votes
4 answers
73k views

Getting R plots into LaTeX?

I'm a newbie to both R and LaTeX and have just recently found how to plot a standard time series graph using R and save it as a png image. What I'm worried about is that saving it as an image and then ...
agentofuser's user avatar
  • 9,177
70 votes
10 answers
541k views

Setting background color for a JFrame

How do you set the background color for a JFrame?
user avatar
69 votes
3 answers
57k views

Getting the true z value from the depth buffer

Sampling from a depth buffer in a shader returns values between 0 and 1, as expected. Given the near- and far- clip planes of the camera, how do I calculate the true z value at this point, i.e. the ...
Hannesh's user avatar
  • 7,398
68 votes
11 answers
30k views

smallest filesize for transparent single pixel image

I'm looking for the smallest (in terms of filesize) transparent 1 pixel image. Currently I have a gif of 49 bytes which seems to be the most popular. But I remember many years ago having one which ...
zaf's user avatar
  • 23k
68 votes
3 answers
60k views

How does glDrawArrays know what to draw?

I am following some begginer OpenGL tutorials, and am a bit confused about this snippet of code: glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject); //Bind GL_ARRAY_BUFFER to our handle ...
w4etwetewtwet's user avatar
66 votes
6 answers
123k views

Android: How to overlay a bitmap and draw over a bitmap?

I have three questions actually: Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise, which one is better? If I want to draw ...
Legend's user avatar
  • 115k
64 votes
8 answers
206k views

Calculating the angle between a line and the x-axis

I'm currently developing a simple 2D game for Android. I have a stationary object that's situated in the center of the screen and I'm trying to get that object to rotate and point to the area on the ...
kingrichard2005's user avatar
64 votes
6 answers
88k views

List all graphic image files with find? [closed]

There are many types of graphic images in this huge archive such as .jpg, .gif, .png, etc. I don't know all the types. Is there a way with 'find' to be able to have it list all the graphic images ...
Edward's user avatar
  • 9,628
62 votes
13 answers
200k views

Writing BMP image in pure c/c++ without other libraries

In my algorithm, I need to create an information output. I need to write a boolean matrix into a bmp file. It must be a monocromic image, where pixels are white if the matrix on such element is true. ...
den bardadym's user avatar
  • 2,787

1
2 3 4 5
423