| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1277 人关注过本帖
标题:很傻很天真的编程问题 by Using Jyphon
只看楼主 加入收藏
qingmui
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-10-6
收藏
 问题点数:0 回复次数:1 
很傻很天真的编程问题 by Using Jyphon
使用Jython Environment for Student编程
问题:
Write a program that reduces the green and increases the blue in the top third of a picture and negates the bottom third. Your color reduction function(s) should be as general as possible, that is, they can reduce or increase by any given amount.

我的解答:

def redneg(a,b):
# this a,b are customize!
   file = r"D:\Picture\gzjietu.jpg"
   pic = makePicture(file)
   for x in range(0,getWidth(pic)):
     for y in range(0,getHeight(pic)/3):
        px = getPixel(pic,x,y)      
        setGreen(px,getGreen(px)*a)
        setBlue(px, getBlue(px)*b)
        
   for x in range(0,getWidth(pic)):
     for y in range(getHeight(pic)-getHeight(pic)*(2/3),getHeight(pic)):   
       px = getPixel(pic, x, y)
       red = getRed(px)
       blue = getBlue(px)
       green = getGreen(px)
       newColor = makeColor(255-red, 255-green, 255-blue)
       setColor=(px,newColor)      
         
   repaint(pic)     
===============

然后我后面的negative picture code好像没用啊
解释器也没说我哪里出问题
搜索更多相关主题的帖子: Using Jyphon 
2010-10-17 08:25
KLML88422
Rank: 2
来 自:火星
等 级:论坛游民
威 望:1
帖 子:34
专家分:20
注 册:2010-11-12
收藏
得分:0 
。。。。。。。。。。。。。。。。。
2010-11-19 09:07
快速回复:很傻很天真的编程问题 by Using Jyphon
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014729 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved