简体   繁体   English

Java 2D底纹/填充

[英]Java 2D Shading / Filling

I have created a "blob" from Bezier curves (screenshot below) and would now like to shade it in such a way that it appears pseudo-3D, with darker shading on all "left" edges and lighter on all "right" edges, and perhaps pure white "light spots" on the surface itself. 我已经根据Bezier曲线创建了一个“斑点”(如下图所示),现在想对其进行着色,使其看起来像伪3D,所有“左侧”边缘的阴影都更深,而所有“右侧”边缘的阴影都更浅,以及表面上纯白色的“光斑”。 For example: I'd be interested in how to achieve the shading used in this video . 例如:我会对如何实现本视频中使用的阴影感兴趣。

  • Can anyone recommend a good way to achieve this? 谁能推荐实现这一目标的好方法? I am guessing that standard Graphics2D.fill and setPaint methods may not be sophisticated enough. 我猜想标准的Graphics2D.fill和setPaint方法可能不够复杂。
  • Also, can anyone recommend some good resources (preferrably free / online) for learning more on this? 另外,有人可以推荐一些好的资源(最好是免费的/在线的)来学习更多吗?

EDIT 编辑

Some additional information: To achieve the flat fill effect below I'm creating an Area object and am adding the individual Ellipse2D Shape s to it using add(new Area(ellipse)) and then finally adding the central polygon area to avoid leaving a white space in the middle. 一些其他信息:为了达到下面的扁平填充效果,我创建了一个Area对象,并使用add(new Area(ellipse))单个Ellipse2D Shape ,然后最后添加中央多边形区域以避免留下白色中间的空间。

alt text http://www.freeimagehosting.net/uploads/bc8081cbf2.png 替代文字http://www.freeimagehosting.net/uploads/bc8081cbf2.png

The IPhone apps have access to OpenGL-ES which allows significant latitude in shading and rendering what is basically a coloured iso-surface with emissive lighting. iPhone应用程序可以访问OpenGL-ES ,从而可以在阴影和渲染基本上是带有放射照明的彩色等值面方面获得很大的自由度。 Java2d will definitely not be sophisticated enough unless you are willing to write a whole software 3d library for it. 除非您愿意为它编写整个软件3d库,否则Java2d肯定不够复杂。

Mixing 2d and 3d is also possible . 可以混合2d和3d。

I used a custom RadialGradientPaint in this kineic model to get a pseudo-3D effect. 我使用了自定义的RadialGradientPaint在这个kineic模型得到的伪3D效果。 I believe a more general implementation is available in Java 6. 我相信Java 6中提供了更通用的实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM