0

This is not a typical "what library do i use?" or "is there an API for that". Using lines of code I create not implementing them through a library of sorts. Is there any documentation on how to actually create a window, and within that window draw a line from pixels?

I just want to understand how its done, and not learn through a library which does it for me.

Previously tried: JavaFx Swing

StingRay21
  • 342
  • 5
  • 15
  • 1
    I basically asked this question [here](http://stackoverflow.com/questions/6553845/id-like-to-draw-pixels-on-a-window-with-mouse-input) – motoku Dec 14 '14 at 02:42
  • @SeanPedersen Im not trying to draw it with a mouse, im trying to simply put the shape on the screen with no use of API or framework or library – StingRay21 Dec 14 '14 at 02:43
  • You want to "create a window, and within that window draw a line from pixels". That sounds a lot like "draw pixes on a window". – motoku Dec 14 '14 at 02:48
  • You can also check out [Drawing Geometric Primitives](https://docs.oracle.com/javase/tutorial/2d/geometry/primitives.html). – motoku Dec 14 '14 at 02:53
  • You could try looking at the source code for Swing to see how it's done. I'd just stick to using libraries, though, as it's much easier. – kirbyquerby Dec 14 '14 at 03:26

1 Answers1

1

If you want to draw a line in a window, you'll ultimately have to create a BufferedImage, set pixels in that BufferedImage according to some drawing algorithm (like Bresenham's), then put the BufferedImage in the window.

twinlakes
  • 9,438
  • 6
  • 31
  • 42