def testResize(): srcBmp = avg.Bitmap('media/rgb24-32x32.png') destBmp = srcBmp.getResized((64,64)) self.assert_(destBmp.getSize() == (64,64)) node = avg.ImageNode(pos=(128,0), size=(32,32), parent=root) node.setBitmap(destBmp)
def testCropRect(): bmp = avg.Bitmap('media/rgb24-65x65.png') bmp1 = avg.Bitmap(bmp, (32,32), (64,64)) self.assert_(bmp1.getSize() == (32,32)) node = avg.ImageNode(pos=(96,0), parent=root) node.setBitmap(bmp1)
def loadBitmap(): bmp = avg.Bitmap("media/colorramp.png") self.image.setBitmap(bmp)
def testStringConversion(): bmp = avg.Bitmap('media/rgb24-65x65.png') s = bmp.getPixels() bmp1 = avg.Bitmap(bmp.getSize(), bmp.getFormat(), "sample") bmp1.setPixels(s) self.assert_(self.areSimilarBmps(bmp, bmp1, 0.01, 0.01))
def setFillBitmap(): bmp = avg.Bitmap("media/rgb24-64x64.png") self.rect.setFillBitmap(bmp)
def bmpTexture(): bmp = avg.Bitmap("media/rgb24alpha-64x64.png") self.line.setBitmap(bmp)