'Stuff this pixmap with raw pixel data from a string.
Supply width, height, and one of the imgformat specifiers.'

def fromstring(self, s, width, height, format=imgformat.macrgb):

    if ((format != imgformat.macrgb) and (format != imgformat.macrgb16)):
        raise 'NotImplementedError', 'conversion    to    macrgb    or    macrgb16'
    self.data = s
    self.bounds = (0, 0, width, height)
    self.cmpCount = 3
    self.pixelType = QuickDraw.RGBDirect
    if (format == imgformat.macrgb):
        self.pixelSize = 32
        self.cmpSize = 8
    else:
        self.pixelSize = 16
        self.cmpSize = 5
    self.rowBytes = ((width * self.pixelSize) / 8)
