坐标——Java 2D Oracle官方教程翻译(双语对照)

本文翻译自Oracle官方教程
<<Previous • Trail • Next>>

Coordinates

The Java 2D API maintains two coordinate spaces:

Java 2D API 维护着2个坐标空间:

User space – The space in which graphics primitives are specified

用户空间 – 用于描述图元的空间

Device space – The coordinate system of an output device such as a screen, window, or a printer

设备空间 – 像屏幕、窗口或打印机这一类输出设备的坐标系统

User space is a device-independent logical coordinate system, the coordinate space that your program uses.

用户空间也就是你的程序要使用的坐标空间,它是一个不依赖于设备的逻辑坐标系统。

All geometries passed into Java 2D rendering routines are specified in user-space coordinates.

所有交由 Java 2D 渲染的几何图形都用用户空间坐标来描述。

When the default transformation from user space to device space is used, the origin of user space is the upper-left corner of the component’s drawing area.

从用户空间到设备空间使用默认的坐标变换时,用户空间的原点就是组件绘图区域的左上角。

The x coordinate increases to the right, and the y coordinate increases downward, as shown in the following figure. The top-left corner of a window is 0,0.

如下图所示,x坐标向右递增,y坐标向下递增。窗口的左上角的坐标是 0,0。

All coordinates are specified using integers, which is usually sufficient. However, some cases require floating point or even double precision which are also supported.

所有坐标都使用整数,一般就可以满足需求。必要情况下也可以使用浮点数甚至是双精度数,都是支持的。
在这里插入图片描述

Device space is a device-dependent coordinate system that varies according to the target rendering device.

设备空间是依赖于设备的坐标系统,目标渲染设备不同它也就会有相应的变化。

Although the coordinate system for a window or screen might be very different from the coordinate system of a printer, these differences are invisible to Java programs.

尽管窗口或屏幕的坐标系统可能与打印机的差别很大,但这些都对Java程序没有影响。

The necessary conversions between user space and device space are performed automatically during rendering.

用户空间和设备空间之间必要的转换在渲染过程中就都自动执行了。


<<Previous • Trail • Next>>

发布了9 篇原创文章 · 获赞 0 · 访问量 647

猜你喜欢

转载自blog.csdn.net/realcfuture/article/details/103939013