【问题标题】:smooth() method level parametersmooth() 方法级别参数
【发布时间】:2013-01-26 03:18:56
【问题描述】:

我一直在检查我的一个项目的一些代码,并在与 Smooth() 方法相关的 PApplet 和 PGraphics 类中看到了一些有趣的东西

下面是 PAppplet.java 中的一段代码

public void smooth() {
  if (recorder != null) recorder.smooth();
  g.smooth();
}

public void smooth(int level) {
  if (recorder != null) recorder.smooth(level);
  g.smooth(level);
}

这里的 g 和 recorder 对象都是 PGraphics.java 类的实例,在该类中,这里是平滑方法:

public void smooth() {
  smooth = true;
}
/**
 *
 * @param level either 2, 4, or 8
 */
public void smooth(int level) {
  smooth = true;
}

基本上,设置不同级别的平滑似乎不起作用。我试图输入不同的数字,如 32 64 8 等,但结果根本没有改变。并且您可以查看http://processing.org/reference/smooth_.html 上的 api 页面,它说平滑级别应该可以正常工作,但实际上并没有。

谁能解释为什么上面的代码虽然是用 API 编写的,但对关卡没有任何作用?

【问题讨论】:

    标签: image-processing processing smooth java


    【解决方案1】:

    您不是在查看公共 API,该代码是用于编译处理解释器的内部代码。所以:欢迎来到现实世界,文档和代码并不总是一致的,特别是当一个项目正在为一个新的、完整的修订版本准备时。如果您想从开发人员那里得到答案,您可能想通过在新的 github 代码库上发布问题直接询问他们:https://github.com/processing/processing

    (供将来参考:API 记录在 http://processing.org/reference 上。如果没有在其中提及,即使它在源代码中,它也不属于 API。它的存在是为了让解释器在它完成工作时完成它的工作由Java编译)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-07
      • 2010-09-23
      • 2013-12-16
      • 2011-06-09
      • 1970-01-01
      • 1970-01-01
      • 2012-06-29
      • 1970-01-01
      相关资源
      最近更新 更多