def decode(self):
     self.reader.seek(self.dataOfs, NOESEEK_ABS)
     d = 4 if self.bpp == 2 else 2
     r = rapi.imageDecodePVRTC(self.reader.readBytes((self.w*self.h) // d), self.w, self.h, -self.bpp)
     if self.flip == 1:
         r = rapi.imageFlipRGBA32(r, self.w, self.h, 0, 1)
     return r    
    def parse_file(self):

        headerSize = self.inFile.readUInt()
        width, height = self.inFile.read('2L')
        self.inFile.readUInt()
        self.inFile.readUInt()
        pixSize = self.inFile.readUInt()
        self.inFile.read("2L")
        numColors = self.inFile.readUInt()
        self.inFile.readUInt()

        if numColors:
            palette = self.inFile.readBytes(numColors * 4)
            pixMap = self.inFile.readBytes(width * height)
            pixData = rapi.imageDecodeRawPal(pixMap, palette, height, width, 8,
                                             "b8g8r8p8")
        else:
            if pixSize == 0:
                pixSize = width * height * 3
            pixData = self.inFile.readBytes(pixSize)
            pixData = rapi.imageDecodeRaw(pixData, width, height, 'b8g8r8')
        pixData = rapi.imageFlipRGBA32(pixData, width, height, 0, 1)
        tex = NoeTexture("tex", width, height, pixData,
                         noesis.NOESISTEX_RGBA32)
        self.texList.append(tex)
 def decode(self):
     self.reader.seek(self.dataOfs, NOESEEK_ABS)
     d = 4 if self.bpp == 2 else 2
     r = rapi.imageDecodePVRTC(
         self.reader.readBytes((self.w * self.h) // d), self.w, self.h,
         -self.bpp)
     if self.flip == 1:
         r = rapi.imageFlipRGBA32(r, self.w, self.h, 0, 1)
     return r
 def parse_file(self):
     
     self.inFile.readBytes(4)
     self.inFile.readBytes(6)
     self.inFile.read('2L')
     width, height = self.inFile.read('2L')
     self.inFile.read('2H')
     self.inFile.read('2L')
     self.inFile.read('2L')
     self.inFile.read('2L')
     
     pixData = self.inFile.readBytes(width*height*3)        
     imgPix = rapi.imageDecodeRaw(pixData, width, height, "b8g8r8")
     imgPix = rapi.imageFlipRGBA32(imgPix, width, height, 0, 1)
     tex = NoeTexture("texture", width, height, imgPix, noesis.NOESISTEX_RGBA32)
     self.texList.append(tex)
 def parse_file(self):
     
     headerSize = self.inFile.readUInt()
     width, height = self.inFile.read('2L')
     self.inFile.readUInt()
     self.inFile.readUInt()
     pixSize = self.inFile.readUInt()
     self.inFile.read("2L")
     numColors = self.inFile.readUInt()
     self.inFile.readUInt()
     
     if numColors:
         palette = self.inFile.readBytes(numColors*4)
         pixMap = self.inFile.readBytes(width*height)
         pixData = rapi.imageDecodeRawPal(pixMap, palette, height, width, 8, "b8g8r8p8")
     else:
         if pixSize == 0:
             pixSize = width * height * 3            
         pixData = self.inFile.readBytes(pixSize)
         pixData = rapi.imageDecodeRaw(pixData, width, height, 'b8g8r8')
     pixData = rapi.imageFlipRGBA32(pixData, width, height, 0, 1)
     tex = NoeTexture("tex", width, height, pixData, noesis.NOESISTEX_RGBA32)
     self.texList.append(tex)