vmware-svga/examples/screen-cursor/scripts/img2rgbapre.py
Micah Dowty 68478eab4b There are many new tests and examples that we wrote internally at VMware,
but couldn't release immediately since they depended on virtual GPU features
which were not yet publicly released in any products.  This checkin moves those
features from our internal repository to the open source repository. Future   
development on these tests and examples will take place directly in the open
source repository.

The primary feature added by this patch is 'Screen Object', a new dynamic
display management extension supported by Workstation 7.0 and Fusion 3.0.
See the README for a quick explanation.
2009-10-21 20:20:49 +00:00

30 lines
511 B
Python
Executable file

#!/usr/bin/env python
#
# Convert an image file to hexadecimal words of pre-multiplied RGBA data.
#
# -- Micah Dowty <micah@vmware.com>
#
import Image
import sys
im = Image.open(sys.argv[1])
sys.stderr.write("width=%d height=%d\n" % im.size)
words = []
def flush():
print " ".join(words)
del words[:]
for r, g, b, a in im.getdata():
r = r * a // 255
g = g * a // 255
b = b * a // 255
words.append("0x%02x%02x%02x%02x," % (a,r,g,b))
if len(words) >= 6:
flush()
flush()