Coordinate Spaces: User Space and Device Space

The critical concept necessary for understanding graphics and imaging on the Java platform is the idea of user space and device space because they will be used extensively in this and other sections of the book.

User space is the coordinate space in which the user operates. At instantiation, the origin of user space is at the top-left corner of the screen with the x coordinate increasing to the right and the y coordinate increasing downward. The user can move, translate, and otherwise change the user space.

Note

User space is independent of the space of all output devices.


Device space, on the other hand, is completely dependent on the output device and its drivers. Based on the requirements of the targeted device space, Java 2D will create a transformation of the user space to device space (see Figure 2.1), including a color transformation and a resolution transformation. Thankfully, the application developer doesn't need to make this transformation. Knowing that and how the user space to device space transformation occurs, however, is key for understanding the mechanisms and capabilities of Java-based graphics and imaging. The hypothetical device space in Figure 2.1 has a different size and orientation than the user space in which the graphic (in this case, a plus sign) is drawn. A transformation exists between the two spaces so that everything looks as expected when the graphic is rendered.

Figure 2.1. User space and a hypothetical device space.


So, what's the big deal about user and device space? It comes down to Java's capability to support many devices on many platforms. To reiterate, user space is a generic, device independent space to which graphics can be drawn without concern for the ultimate output destination. Device space is device dependent and conforms to the specific requirements of the target device. Understanding this difference will serve the reader well during all further discussion.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset