1.1.0版本
This commit is contained in:
21
UniTAP/libs/lib_pdl/pdl.py
Normal file
21
UniTAP/libs/lib_pdl/pdl.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
from UniTAP.common import VideoFrame, ColorInfo, DataInfo, get_vf_from_image
|
||||
from UniTAP.utils import video_frame_to_ci
|
||||
from .pdl_types import *
|
||||
|
||||
UNIGRAF_IMAGE_PATH = os.path.join(os.path.dirname(__file__), "Default_16K.png")
|
||||
|
||||
|
||||
def generate_pattern_as_vf(pattern_type: PatternType, width: int, height: int,
|
||||
color_info: ColorInfo, data_info: DataInfo) -> VideoFrame:
|
||||
if pattern_type != PatternType.Unigraf:
|
||||
raise NotImplementedError("Generating ColorRamp and ColorSquares not supported yet.")
|
||||
|
||||
if pattern_type == PatternType.Unigraf:
|
||||
if not os.path.exists(UNIGRAF_IMAGE_PATH):
|
||||
raise FileNotFoundError("Unigraf default image not found. Not possible to generate "
|
||||
"Unigraf pattern.")
|
||||
vf = get_vf_from_image(UNIGRAF_IMAGE_PATH, width, height)
|
||||
|
||||
return video_frame_to_ci(vf, color_info, data_info)
|
||||
Reference in New Issue
Block a user