def LoadValiant(self): path = self.inputImagePath importer = memory_importer.MemoryImporter() mem = importer.read_valiant(path) renderer = pixel_art_renderer.PixelArtRenderer() img = renderer.render(mem) outfile = tempfile.mkstemp(suffix='.png')[1] img.save(outfile) self.inputImagePath = outfile self.processor._err = errors.ErrorCollector() self.processor._ppu_memory = mem self.ShowMessage('Opened "%s"' % path, 4.0)
def initialize(self): self._ppu_memory = ppu_memory.PpuMemory() self._chrdata_cache = {} self._color_manifest = id_manifest.IdManifest() self._dot_manifest = id_manifest.IdManifest() self._block_color_manifest = id_manifest.IdManifest() self._needs_provider = None self._artifacts = None self._flip_bits = None self._err = errors.ErrorCollector() self.image_x = self.image_y = None self.tile_ctor = None
def process_image(self, img, args): self._err = errors.ErrorCollector() self.width, self.height = img.size self.pixels = img.load() self.base = image_processor.ImageProcessor() self.base.pixels = self.pixels try: self.unit_size = self._find_unit_size() self.pal = self._build_palette() except Exception as e: self._err.add(e) return
def LoadImportedRam(self): path = self.inputImagePath importer = memory_importer.MemoryImporter() mem = importer.read_ram(path) renderer = pixel_art_renderer.PixelArtRenderer() img = renderer.render(mem) outfile = tempfile.mkstemp(suffix='.png')[1] img.save(outfile) self.inputImagePath = outfile self.processor._err = errors.ErrorCollector() self.processor._ppu_memory = mem self.ReassignImage() self.CreateViews() self.OnImageLoaded() self.ShowMessage('Imported RAM from "%s"' % path, 4.0)
def initialize(self): self._ppu_memory = ppu_memory.PpuMemory() self._chrdata_cache = {} self._color_manifest = id_manifest.IdManifest() self._dot_manifest = id_manifest.IdManifest() self._block_color_manifest = id_manifest.IdManifest() self._needs_provider = None self._artifacts = [ row[:] for row in [[None] * (NUM_BLOCKS_X * 2)] * (NUM_BLOCKS_Y * 2) ] self._flip_bits = [ row[:] for row in [[0] * (NUM_BLOCKS_X * 2)] * (NUM_BLOCKS_Y * 2) ] self._err = errors.ErrorCollector() self.image_x = self.image_y = None