Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a graphics context (In Java)?

I have seen the term several times, what does it mean?

like image 541
w4j3d Avatar asked Oct 22 '10 21:10

w4j3d


People also ask

What is a Graphics context?

A graphics context defines basic drawing attributes such as the colors to use when drawing, the clipping area, line width and style information, font information, compositing options, and several others.

What is Graphics object in Java?

A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties: The Component object on which to draw. A translation origin for rendering and clipping coordinates.

Which method is used Graphics class object as argument in Java?

Because the Graphics class is an abstract base class, it cannot be instantiated directly. An instance is typically created by a component, and handed to the program as an argument to a component's update() and paint() methods. These two methods, along with the repaint() method, are discussed in the next section.


1 Answers

"Context" is a generic name that many java developers use for classes that carry state information. So are bound to see a lot of different class names containing context.

Graphic context in desktop Java usually means java.awt.Graphics or java.awt.Graphics2D classes. They carry information about drawing properties: colors, line properties, clipping regions, etc..

like image 61
Peter Knego Avatar answered Sep 20 '22 11:09

Peter Knego