更快:SWT 还是 Java2D?
SWT 和 Java2D 哪个具有更快的图形性能?
在 MacOSX 上,SWT 的图形是否通过 Quartz Extreme,而 Quartz Extreme 又使用硬件加速的 OpenGL 进行渲染?
我不是指本机 UI 控件,而是询问自定义 2D 图形渲染,如文本、线条、曲线和多边形。
Which has faster graphics performance: SWT or Java2D?
On MacOSX, Does SWT's graphics go through Quartz Extreme which in turn is rendered using hardware-accelerated OpenGL?
I'm not referring to the native UI controls but asking about custom 2D graphics rendering like text, lines, curves and polygons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
两者都使用平台的图形 API
Java Swing 和 SWT 采用相反的方法。
Java Swing 使用 Java2D 来绘制其小部件和自定义绘图,这是一个跨平台图形 api,它抽象了底层平台的图形 api。现在Java2D的性能取决于性能和性能。平台原生 API 的效率。
SWT 使用平台的本机图形 API 进行自定义绘图,并使用平台的本机 GUI API(如果存在)来绘制其小部件。现在需要注意的一点是,对于大多数平台,GUI API 本身使用平台的图形 API 来绘制小部件。
图形表示
如您所见,最终全部取决于平台的图形 API。因此,两者都提供或多或少相同的性能和功能。速度。
一些例外
有一些例外可能会也可能不会影响性能。
Both Use The Platform's Graphics API
Java Swing and SWT take opposite approaches.
Java Swing uses Java2D both to draw its widgets and for custom drawing, which is a cross-platform graphics api which abstracts the underlying platform's graphics api. Now Java2D's performance depends on the performance & efficiency of the Platform's Native API.
SWT uses the platform's native graphics API for custom drawing and uses the platform's native GUI API (if present) for drawing its widgets. Now the point to be noted is, that for most platforms the GUI API itself uses the platform's graphics API for drawing the widgets.
Graphical Representation
As you can see, ultimately all depend's on the Platform's Graphics API. So both offer more-or-less the same performance & speed.
Some Exceptions
There are some exceptions, that may or may not affect performance.
我理论上认为,SWT 应该更快,因为它直接使用本机 UI 实现。
但在实践中,这完全取决于每个平台上的 SWT 和 SWING 实现。
根据我的经验,SWT 在 Windows 中更快,但在 Mac OS X 上并不快。
I theory, SWT should be faster since it directly uses native UI implementations.
But in practice, it all depends on SWT and SWING implementations on each platform.
In my experience, SWT is faster in Windows, but it is not faster on Mac OS X.