如何这几一个数据结构方法在白色画板上实现一个实心矩阵?

如何这几一个数据结构方法在白色画板上实现一个实心矩阵?

题目2:
一个大小是M*N大小的白色画板P(r=255,g=255,b=255), 即M像素*N像素,每个像素由r、g、b共 3个颜色组成,每个颜色值是0~255。设计一个方法、数据结构,实现对这张白色图片绘制一些实心矩形。
函数声明大概是 draw(P, 矩形数据, 绘制颜色),支持2种输出:A:打印图片结果 B:存到文件中(不需要读取功能)

可以打印结果(打印数值即可,不需要用图像api绘制) , PrintImg(P): 
(r,g,b)(r,g,b) (r,g,b).....
(r,g,b)(r,g,b) (r,g,b).....
(r,g,b)(r,g,b) (r,g,b).....
...
存到文件中 , SaveImg(P):
f = open(filename, 'w')
f.write(P)

不限语言(最好python)和环境,只需要写好函数(简单的注释),或者提供思路

大佬们,最近被这个题难到了,有没有人能提供代码或者思路,谢谢谢谢

540Immortal
浏览 1108回答 0
0回答

慕斯4360584

VHXKBKKAANKGNWJZWIILFCVBRRIVPFCZPKIIMVZCYSYFSHLIOBLVPMMTSSVVSSMJUUXNAANZXHURBHXXDDXZMWJFKHKKAXBRVYLVSVLLDBXRYODZMFFRKEYSSAQGZPCHEXBOHMSIZWGDRWPKDMTTJPPCPFXNMJTJRLESRWTJJZMJMJGCJLIYYBPCMJPQTNJAGHUXKHFYPSYYZZCPCPSFSLISMZMMAPPAKHOHEHELHWTTWNKOBEVKAXNKDDQUKAMJTLRLILSLFYOEUBEEOVIQZZWCTXDQNUFRQUUMCLPCZKAANJWMMGFBKWZWTGJMADKHDGFPSCSLPIWIJWTWJTDEOCYUHRREUYLXGZALFXLOBGVKRRYYHOOLYSZMYVLLFVYIBCOLLRXFEBHUPQXDWTWSPFSOBNUDQTZMSCHXWTCSCFLYKHPPIFBNTAAZBRUNTDGNZXJJSMKTJZWCIOJJPZPQHWZPMMHKANWTMDJFNCIFSOHUEANHWZCSAWGWMVDMSIVNPBUMOMOUHYUGPZSIJVEBXDIVOVBKWSCTWZCPVBILUHETQNDQGMJMQHDKL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