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).

Graphics

The tag should be assigned to questions about constructing, displaying and manipulating visual presentations. Questions should also be tagged with the appropriate language and graphics subsystem in use. For more general graphics questions, consider Computer Graphics Stackexchange.

While historically there were two parallel developments of vector and raster (bitmap) systems, modern systems all implement the raster model at the hardware layer but may use extensive applications of vector graphics techniques at higher levels. The entire chain through the various levels to go from model to picture on screen is known as the pipeline.

The Borland Graphics Interface (graphics.h) has its own tag:

Examples

Construction:

  • How to turn raw data into a bitmap?
  • How to generate a chart, how to draw using vectors?
  • How to load a .3ds file and display the model?

Displaying

  • How to display a large bitmap scaled down?
  • How to use an image as a texture for a control?
  • How to ray-trace voxel data?

Manipulating

  • How to modify images using common effects such as filters?
  • How to create animations?

Counterexamples

  • How to draw using a paint program? --> too basic, not programming related
  • How to take a picture when there is not enough light? --> see Photography
  • How to scan a pencil drawing? --> software tools, see SuperUser
  • What graphics card should I buy? --> shopping questions are off-topic on most SE sites

Resources

Free Graphics Programming Books

20510 questions
66
votes
3 answers

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 distance from the camera?
Hannesh
  • 7,256
  • 7
  • 46
  • 80
64
votes
8 answers

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 screen that the user touches. I have the…
kingrichard2005
  • 7,179
  • 21
  • 86
  • 118
64
votes
6 answers

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 something transparent over a bitmap, how would I go…
Legend
  • 113,822
  • 119
  • 272
  • 400
62
votes
13 answers

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. Main problem is the bmp header and how to write…
den bardadym
  • 2,747
  • 3
  • 25
  • 27
61
votes
6 answers

List all graphic image files with find?

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 regardless of their dot extension name? Thanks!
Edward
  • 9,430
  • 19
  • 48
  • 71
60
votes
7 answers

Qt jpg image display

I want to display .jpg image in an Qt UI. I checked it online and found https://doc.qt.io/archives/qt-4.8/qt-widgets-imageviewer-example.html. I thought Graphics View will do the same, and also it has codec to display video. How to display images…
Lily
  • 5,872
  • 19
  • 56
  • 75
60
votes
1 answer

How to add text to an image in java?

I need to add some texts to an existing table image (png). Which means that I need to "write" on the image and I need the option to select the text location. How can I do it?
whiteberryapps
  • 1,392
  • 4
  • 16
  • 21
58
votes
3 answers

Can I draw with antialiasing on canvas?

Can I draw with anti-aliasing on canvas? I need my circles and line have smooth edges.
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
57
votes
8 answers

Setting A CGContext Transparent Background

I am still struggling with drawing a line with CGContext. I have actually go to line to draw, but now I need the background of the Rect to be transparent so the existing background shows thru. Here's my test code: (void)drawRect:(CGRect)rect { …
Jim B
  • 2,267
  • 6
  • 24
  • 26
57
votes
3 answers

How to print R graphics to multiple pages of a PDF and multiple PDFs?

I know that pdf("myOut.pdf") will print to a PDF in R. What if I want to Make a loop that prints subsequent graphs on new pages of a PDF file (appending to the end)? Make a loop that prints subsequent graphs to new PDF files (one graph per…
Dan Goldstein
  • 24,229
  • 18
  • 37
  • 41
56
votes
4 answers

math/algorithm Fit image to screen retain aspect ratio

I need help with math / algorithm to take an image of known size and fit to one of two screen dimensions: 720 x 480 or 1280 x 1024. The image dimensions are coming from an XML file, however those dimensions are the web dimensions, I also get a…
alphablender
  • 2,168
  • 5
  • 27
  • 42
56
votes
7 answers

correcting fisheye distortion programmatically

BOUNTY STATUS UPDATE: I discovered how to map a linear lens, from destination coordinates to source coordinates. How do you calculate the radial distance from the centre to go from fisheye to rectilinear? 1). I actually struggle to reverse it,…
Will
  • 73,905
  • 40
  • 169
  • 246
55
votes
6 answers

How do you order the fill-colours within ggplot2 geom_bar

I am calling the ggplot function ggplot(data,aes(x,y,fill=category)+geom_bar(stat="identity") The result is a barplot with bars filled by various colours corresponding to category. However the ordering of the colours is not consistent from bar to…
Dave31415
  • 2,846
  • 4
  • 26
  • 34
54
votes
4 answers

C# graph drawing library?

I'm looking for a (free) library which allows me to draw a CFG (control flow graph). Something like yFiles, but free or preferably open source? Ideally this library would allow the user to navigate the graph (and modify it), i.e. the graph isn't…
newgre
  • 5,245
  • 4
  • 31
  • 41
54
votes
3 answers

why are draw calls expensive?

assuming the texture, vertex, and shader data are already on the graphics card, you don't need to send much data to the card. there's a few bytes to identify the data, and presumably a 4x4 matrix, and some assorted other parameters. so where is all…
notallama
  • 1,069
  • 1
  • 8
  • 11