Java - Creating an image -


i'm working on game in java , trying create background without using image files. image consists of square split 4 triangles, each of different color.

if point me towards of using graphics2d , saving bufferedimage, great.

i recommend:

  • first create bufferedimage using constructor takes 3 ints: width, height, , bufferedimage type, bufferedimage.type_int_argb work well, , width , height constants in program.
  • you extract graphics2d object out of bufferedimage calling creategraphics() method.
  • then draw graphics object using drawxxx(...) methods of have many select from.
  • to change color, call setcolor(color c) on graphics/graphics2d object.
  • when done drawing, sure dispose of graphics object via dispose() method.
  • edit per adrian blackburn, check out bufferedimage tutorial part of standard oracle java tutorials.

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -