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
43
votes
9 answers

A Simple, 2d cross-platform graphics library for c or c++?

As in title, i need a 2d graphics library that is cross-platform, and provides simple functions, like in Basic; essentially, i only need to paint a pixel a certain color-I do not need hardware acceleration, or any kind of 3d support. I've found a…
Agasa
43
votes
10 answers

Convert string to Brushes/Brush color name in C#

I have a configuration file where a developer can specify a text color by passing in a string: Rather than have a gigantic switch statement look for all of the possible colors, it'd be nice to just use the…
Clinton Pierce
  • 12,859
  • 15
  • 62
  • 90
43
votes
2 answers

How to test graphical output of functions?

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…
sgibb
  • 25,396
  • 3
  • 68
  • 74
42
votes
8 answers

Inverse Bilinear Interpolation?

I have four 2d points, p0 = (x0,y0), p1 = (x1,y1), etc. that form a quadrilateral. In my case, the quad is not rectangular, but it should at least be convex. p2 --- p3 | | t | p | | | p0 --- p1 s I'm using bilinear…
tfinniga
  • 6,693
  • 3
  • 32
  • 37
42
votes
8 answers

Plotting pca biplot with ggplot2

I wonder if it is possible to plot pca biplot results with ggplot2. Suppose if I want to display the following biplot results with ggplot2 fit <- princomp(USArrests, cor=TRUE) summary(fit) biplot(fit) Any help will be highly appreciated. Thanks
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
42
votes
4 answers

Sklearn plot_tree plot is too small

I have this simple code: clf = tree.DecisionTreeClassifier() clf = clf.fit(X, y) tree.plot_tree(clf.fit(X, y)) plt.show() And the result I get is this graph: How do I make this graph legible? I'm using PyCharm Professional 2019.3 as my IDE.
Artur
  • 614
  • 1
  • 6
  • 9
42
votes
4 answers

Haskell library for 2D drawing

I basically want to create a full screen window and draw text on it in different colors and sizes (and also update the screen). I've used pygame for this in python and I'm looking for a similar library (should be fairly easy to use). +1 if it…
akosch
  • 4,326
  • 7
  • 59
  • 80
42
votes
4 answers

Generating a normal map from a height map?

I'm working on procedurally generating patches of dirt using randomized fractals for a video game. I've already generated a height map using the midpoint displacement algorithm and saved it to a texture. I have some ideas for how to turn that into a…
Dawson
  • 2,673
  • 1
  • 16
  • 18
42
votes
2 answers

Performant 2D SDL or OpenGL graphics in R for fast display of raster image using rdyncall package and SDL/OpenGL calls

In R, it seems none of the currently available options (e.g. image) allow for fast real-time display of 2D raster graphics. I was interested for example to make a real-time interactive Mandelbrot viewer, where I was hoping to display 1920x1080 raw…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
42
votes
2 answers

How exactly does OpenGL do perspectively correct linear interpolation?

If linear interpolation happens during the rasterization stage in the OpenGL pipeline, and the vertices have already been transformed to screen-space, where does the depth information used for perspectively correct interpolation come from? Can…
AIGuy110
  • 1,025
  • 1
  • 10
  • 11
42
votes
2 answers

What is the difference between cubic bezier and quadratic bezier and their use cases?

I have been playing around with canvas recently and have been drawing several shapes (tear drops, flower petals, clouds, rocks) using methods associated with these curves. With that said, I can't seem to figure out the difference between the use…
Conqueror
  • 4,265
  • 7
  • 35
  • 41
40
votes
12 answers

How to test if a line segment intersects an axis-aligned rectange in 2D?

How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points.
metamal
  • 751
  • 1
  • 6
  • 10
40
votes
7 answers

How do you draw like a Crayon?

Crayon Physics Deluxe is a commercial game that came out recently. Watch the video on the main link to get an idea of what I'm talking about. It allows you to draw shapes and have them react with proper physics. The goal is to move a ball to a…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
40
votes
4 answers

Are there any Android Drawable designers?

I would like to use more vector drawings in my Android applications. Providing images isn't as space efficient or as scalable as I would like it to be. Android provides a series of Drawable file formats, such as ShapeDrawable, which can be combined…
Nathan
  • 1,824
  • 1
  • 21
  • 34
40
votes
6 answers

Set of efficient 3D intersection algorithms

Anyone knows a source, website where I can get some good implementations of 3D intersection algorithms, like intersection of sphere and…
Pythagoras of Samos
  • 3,051
  • 5
  • 29
  • 51