Lines Matching refs:f

38         raise ParameterError(f"overflow: {hex(val)}")
76 self.cmd = (f"{executable} {'--nofs' if not dither else ''} "
77 f"{ncolors} --force - < ")
81 raise BaseException(f"file not found: {filename}")
85 f'{self.cmd} "{str(filename)}"',
325 header = f'''
348 ending = f'''
364 def write_binary(f, data, stride): argument
368 f.write("\n ")
369 f.write(f"0x{v:02x},")
370 f.write("\n")
372 with open(filename, "w+") as f:
373 f.write(header)
376 write_binary(f, data, 16)
381 write_binary(f, data[:ncolors * 4], 16)
383 write_binary(f, data[ncolors * 4:], stride)
385 f.write(ending)
402 raise ParameterError(f"w, h overflow: {w}x{h}")
405 raise ParameterError(f"Invalid stride align: {align}")
417 raise ParameterError(f"Invalid stride align: {align}")
447 raise FormatError(f"invalid color format: {hex(data[0])}") from exc
479 raise ParameterError(f"Invalid compress method: {self.compress}")
504 return (f"'LVGL image {self.w}x{self.h}, {self.cf.name}, "
505 f"{'Pre-multiplied, ' if self.premultiplied else ''}"
506 f"stride: {self.stride} "
507 f"(12+{self.data_len})Byte'")
525 raise ParameterError(f"Invalid parameter, align:{align},"
526 f" stride:{stride}")
539 raise ParameterError(f"Stride is too small:{stride}, "
540 f"minimal:{current.stride_default}")
584 raise ParameterError(f"Image has no alpha channel: {self.cf.name}")
663 raise ParameterError(f"Not supported yet: {self.cf.name}")
700 raise ParameterError(f"w, h overflow: {w}x{h}")
711 raise ParameterError(f"{self} data length error got: {len(data)}, "
712 f"expect: {self.data_len}, {self}")
731 with open(filename, "rb") as f:
732 data = f.read()
737 raise FormatError(f"filename not ended with {ext}")
742 logging.info(f"mkdir of {dir} for {filename}")
754 with open(filename, "wb+") as f:
769 f.write(bin)
831 logging.warning(f"missing logic: {self.cf.name}")
834 with open(filename, "wb") as f:
835 encoder.write_array(f, data)
870 logging.warning(f"missing logic: {cf.name}")
872 logging.info(f"from png: {filename}, cf: {self.cf.name}")
907 f"{path.basename(filename)} palette: {palette_len}, "
908 f"extended to: {cf.ncolors}")
932 raise FormatError(f"{filename} has no alpha channel")
1018 raise FormatError(f"Invalid color format: {cf.name}")
1123 with open(filename, "wb+") as f:
1126 f.write(header)
1127 f.write(compressed)
1239 raise RAWImage.NotSupported(f"Invalid color format: {cf.name}")
1241 with open(filename, "rb") as f:
1242 self.data = f.read()
1289 for f in self.files:
1292 img = RAWImage().from_file(f, self.cf)
1293 img.to_c_array(self._replace_ext(f, ".c"))
1295 …img = LVGLImage().from_png(f, self.cf, background=self.background, rgb565_dither=self.rgb565_dithe…
1300 output.append((f, img))
1302 img.to_bin(self._replace_ext(f, ".bin"),
1305 img.to_c_array(self._replace_ext(f, ".c"),
1308 img.to_png(self._replace_ext(f, ".png"))
1368 raise BaseException(f"invalid input: {args.input}")
1373 logging.info(f"options: {args.__dict__}, files:{[str(f) for f in files]}")
1395 for f, img in output:
1396 logging.info(f"len: {img.data_len} for {path.basename(f)} ")
1398 print(f"done {len(files)} files")
1403 f = "pngs/cogwheel.RGB565A8.png"
1404 img = LVGLImage().from_png(f,
1417 f = "pngs/cogwheel.RGB565A8.png"
1418 img = RAWImage().from_file(f,