如何在JES中创建拼贴画



我有一个项目,用6个图像副本创建拼贴,其中一些是翻转的,一些是颜色变化的,等等。我对这一切都是全新的,几乎不知道自己在做什么。我写了我的代码,但当我在JES和命令explore(newpicture)中测试它时,会弹出一个标题为"无"的白框。我试着把它搞砸了,但被卡住了。在此之前,我有所有的def,用于翻转、更改颜色百分比等。我想我的问题是我测试不正确,或者是下面的偏移或拼贴代码。为了测试,我正在输入:

    verticalPicture = flipVertically(myPict)
    redPicture = matchRedToGreen(myPict)
    negativePicture = negative(myPict)
    bluePicture = clearBlue(myPict)
    clockwisePicture = rotateC90(myPict)
    newpicture = makeCollage(myPict)
    explore(newpicture)
def offsetPicture(littlePicture, bigPicture, xOffset, yOffset):
  for aPixel in getPixels(myPict):
  littleX = getX(aPixel)
  littleY = getY(aPixel)
  bigX = littleX + xOffset
  bigY = littleY + yOffset
  bigPicturePixel = getPixel (bigPicture, bigX, 375)
  setColor(bigPicturePixel, getColor (aPixel))
def makeCollage(myPict):
 newWidth = 3*getWidth(myPict)
 newHeight = 2*getHeight(myPict)
 bigPicture = makeEmptyPicture(newWidth, newHeight)
 offsetPicture(littlePicture, bigPicture, 0, 0)
 offsetPicture(clockwisePicture, bigPicture, getWidth(myPict), 0)
 offsetPicture(redPicture, bigPicture, 0, getHeight(myPict))
 offsetPicture(bluePicture, bigPicture, 2*getWidth(myPict), 0)
 offsetPicture(verticalPicture, bigPicture, getWidth(myPict), getHeight(myPict))
 offsetPicture(negativePicture, bigPicture, 2*getWidth(myPict), 2*getHeight(myPict))
return (bigPicture)

代码中存在一些缩进错误。我不知道这是否是将代码复制并粘贴到Stack Overflow中的结果。

发现的错误:

  • makeCollage()return语句需要再缩进一个空格
  • offsetPicture()中for循环之后的语句需要缩进

还有下面几行代码,你在顶部有。这些行应该在你定义了你的函数之后。

verticalPicture = flipVertically(myPict)
redPicture = matchRedToGreen(myPict)
negativePicture = negative(myPict)
bluePicture = clearBlue(myPict)
clockwisePicture = rotateC90(myPict)
newpicture = makeCollage(myPict)
explore(newpicture)

相关内容

  • 没有找到相关文章

最新更新