File tree Expand file tree Collapse file tree 4 files changed +76
-0
lines changed
Expand file tree Collapse file tree 4 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 99
1010__version__ = "0.0.0" # dynamic
1111
12+ from .exr_enums import *
13+ from .exr_channel_info import *
14+ from .exr_channel_sampling_rate import *
1215from openexr_python .header import Header
16+ from .exr_window import *
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+ from typing import Any , Type
3+ from openexr_python .exr_enums .exr_image_data_type import EXRImageDataType
4+ from openexr_python .exr_channel_sampling_rate import EXRChannelSamplingRate
5+
6+
7+ @dataclass
8+ class EXRChannelInfo :
9+ data_type : Type [EXRImageDataType ]
10+ sampling_rate : EXRChannelSamplingRate
11+
12+ @classmethod
13+ def parse_raw2pyobj (cls , raw_channel_info : Any ):
14+ return EXRChannelInfo (
15+ data_type = EXRImageDataType .parse_raw2pyobj (
16+ raw_channel_info = raw_channel_info ,
17+ ),
18+ sampling_rate = EXRChannelSamplingRate .parse_raw2pyobj (
19+ raw_channel_info = raw_channel_info ,
20+ ),
21+ )
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+ from typing import Any
3+
4+
5+ @dataclass
6+ class EXRChannelSamplingRate :
7+ x_sampling : int
8+ y_sampling : int
9+
10+ @classmethod
11+ def parse_raw2pyobj (cls , raw_channel_info : Any ):
12+ return EXRChannelSamplingRate (
13+ x_sampling = raw_channel_info .xSampling , y_sampling = raw_channel_info .ySampling
14+ )
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+ from typing import Any , Tuple
3+
4+
5+ @dataclass
6+ class EXRWindow :
7+ x_min : int
8+ y_min : int
9+ x_max : int
10+ y_max : int
11+
12+ @property
13+ def min (self ) -> Tuple [int , int ]:
14+ return (self .x_min , self .y_min )
15+
16+ @property
17+ def max (self ) -> Tuple [int , int ]:
18+ return (self .x_max , self .y_max )
19+
20+ @property
21+ def width (self ) -> int :
22+ assert self .x_max > self .x_min
23+ return 1 + self .x_max - self .x_min
24+
25+ @property
26+ def height (self ) -> int :
27+ assert self .y_max > self .y_min
28+ return 1 + self .y_max - self .y_min
29+
30+ @classmethod
31+ def parse_raw_to_window (cls , raw_window : Any ):
32+ return EXRWindow (
33+ x_min = raw_window .min .x ,
34+ y_min = raw_window .min .y ,
35+ x_max = raw_window .max .x ,
36+ y_max = raw_window .max .y ,
37+ )
You can’t perform that action at this time.
0 commit comments