예제 #1
0
 def crop_left(self) -> Optional[Percent]:
     if self._src_rect is not None:
         l_str = self._src_rect.get('l')
         if l_str is not None:
             return Percent(l_str)
     if self.do_use_defaults_when_null:
         return self._default_crop_left
     return None
예제 #2
0
 def crop_top(self) -> Optional[Percent]:
     if self._src_rect is not None:
         t_str = self._src_rect.get('t')
         if t_str is not None:
             return Percent(t_str)
     if self.do_use_defaults_when_null:
         return self._default_crop_top
     return None
예제 #3
0
 def crop_bottom(self) -> Optional[Percent]:
     if self._src_rect is not None:
         b_str = self._src_rect.get('b')
         if b_str is not None:
             return Percent(b_str)
     if self.do_use_defaults_when_null:
         return self._default_crop_bottom
     return None
예제 #4
0
 def crop_right(self) -> Optional[Percent]:
     if self._src_rect is not None:
         r_str = self._src_rect.get('r')
         if r_str is not None:
             return Percent(r_str)
     if self.do_use_defaults_when_null:
         return self._default_crop_right
     return None
예제 #5
0
 def gradient_stops(self) -> List[GradientStop]:
     if self._gs_lst is None:
         return list()
     result = list()
     color_maker = self._shape.color_maker
     for gs in self._gs_lst:
         percent = Percent(gs.get('pos', 0))
         color_xml = next(iter(gs))
         color = color_maker.make_color(color_xml)
         result.append(
             self.GradientStop(int(percent.percent100), color.rgb_str,
                               color.alpha))
     return result
예제 #6
0
 def _default_crop_top(self) -> Percent:
     return Percent(0)
예제 #7
0
 def crop_left(self, v: int) -> Percent:
     return Percent(v)
예제 #8
0
 def _default_crop_left(self) -> Percent:
     return Percent(0)
예제 #9
0
 def crop_bottom(self, v: int) -> Percent:
     return Percent(v)
예제 #10
0
 def _default_crop_bottom(self) -> Percent:
     return Percent(0)
예제 #11
0
 def crop_right(self, v: int) -> Percent:
     return Percent(v)
예제 #12
0
 def _default_crop_right(self) -> Percent:
     return Percent(0)
예제 #13
0
 def crop_top(self, v: int) -> Percent:
     return Percent(v)