mirror of
https://github.com/KrisKennaway/ii-pix.git
synced 2024-06-08 06:29:31 +00:00
Merge pull request #10 from KrisKennaway/fix-lookahead
Fix --lookahead parsing
This commit is contained in:
commit
6573bad509
16
convert.py
16
convert.py
|
@ -10,6 +10,7 @@ import image as image_py
|
||||||
import palette as palette_py
|
import palette as palette_py
|
||||||
import screen as screen_py
|
import screen as screen_py
|
||||||
|
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# - support additional graphics modes (easiest --> hardest):
|
# - support additional graphics modes (easiest --> hardest):
|
||||||
# - LR/DLR
|
# - LR/DLR
|
||||||
|
@ -52,10 +53,12 @@ def main():
|
||||||
def validate_lookahead(arg: int) -> int:
|
def validate_lookahead(arg: int) -> int:
|
||||||
try:
|
try:
|
||||||
int_arg = int(arg)
|
int_arg = int(arg)
|
||||||
if int_arg < 1:
|
|
||||||
return int_arg
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
raise argparse.ArgumentTypeError("--lookahead must be an integer")
|
||||||
|
if int_arg < 1:
|
||||||
raise argparse.ArgumentTypeError("--lookahead must be at least 1")
|
raise argparse.ArgumentTypeError("--lookahead must be at least 1")
|
||||||
|
return int_arg
|
||||||
|
|
||||||
dhr_parser.add_argument(
|
dhr_parser.add_argument(
|
||||||
"--lookahead", type=validate_lookahead, default=8,
|
"--lookahead", type=validate_lookahead, default=8,
|
||||||
help=("How many pixels to look ahead to compensate for NTSC colour "
|
help=("How many pixels to look ahead to compensate for NTSC colour "
|
||||||
|
@ -115,23 +118,26 @@ def prepare_image(image_filename: str, show_input: bool, screen,
|
||||||
return image_py.resize(image, screen.X_RES, screen.Y_RES,
|
return image_py.resize(image, screen.X_RES, screen.Y_RES,
|
||||||
gamma=gamma_correct)
|
gamma=gamma_correct)
|
||||||
|
|
||||||
|
|
||||||
def convert_dhr(args):
|
def convert_dhr(args):
|
||||||
palette = palette_py.PALETTES[args.palette]()
|
palette = palette_py.PALETTES[args.palette]()
|
||||||
screen = screen_py.DHGRNTSCScreen(palette)
|
screen = screen_py.DHGRNTSCScreen(palette)
|
||||||
image = prepare_image(args.input, args.show_input, screen,
|
image = prepare_image(args.input, args.show_input, screen,
|
||||||
args.gamma_correct)
|
args.gamma_correct)
|
||||||
convert_dhr_py.convert(screen, image, args)
|
convert_dhr_py.convert(screen, image, args)
|
||||||
|
|
||||||
|
|
||||||
def convert_dhr_mono(args):
|
def convert_dhr_mono(args):
|
||||||
screen = screen_py.DHGRScreen()
|
screen = screen_py.DHGRScreen()
|
||||||
image = prepare_image(args.input, args.show_input, screen, args.gamma_correct)
|
image = prepare_image(args.input, args.show_input, screen,
|
||||||
|
args.gamma_correct)
|
||||||
convert_dhr_py.convert_mono(screen, image, args)
|
convert_dhr_py.convert_mono(screen, image, args)
|
||||||
|
|
||||||
|
|
||||||
def convert_shr(args):
|
def convert_shr(args):
|
||||||
screen = screen_py.SHR320Screen()
|
screen = screen_py.SHR320Screen()
|
||||||
image = prepare_image(args.input, args.show_input, screen, args.gamma_correct)
|
image = prepare_image(args.input, args.show_input, screen,
|
||||||
|
args.gamma_correct)
|
||||||
convert_shr_py.convert(screen, image, args)
|
convert_shr_py.convert(screen, image, args)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user