コード例 #1
1
ファイル: _shadow.py プロジェクト: YannThorimbert/ThorPy-1.0
 def _get_raw_shadow(self):
     target_img = self.target.get_image(self.capture_state)
     r = target_img.get_rect()
     #the shadow will be larger in order to make free space for fadeout.
     r.inflate_ip(2*self.shadow_radius, 2*self.shadow_radius)
     img = Surface(r.size)
     img.fill((255, 255, 255, 255))
     img.blit(target_img, (self.shadow_radius, self.shadow_radius))
     if self.sun_angle <= 0.:
         raise Exception("Sun angle must be greater than zero.")
     elif self.sun_angle != 45. and self.vertical:
         w, h = img.get_size()
         new_h = h / tan(self.sun_angle * pi / 180.)
         screen_size = functions.get_screen().get_size()
         new_h = abs(int(min(new_h, max(screen_size))))
         img = scale(img, (w, new_h))
     if self.angle_mode == "flip":
         img = flip(img, self.mode_value[0], self.mode_value[1])
     elif self.angle_mode == "rotate":
         img = rotate(img, self.mode_value)
     else:
         raise Exception("angle_mode not available: " + str(self.angle_mode))
     shadow = pilgraphics.get_shadow(img,
                                     radius=self.shadow_radius,
                                     black=self.black,
                                     alpha_factor=self.alpha_factor,
                                     decay_mode=self.decay_mode,
                                     color=self.color)
     return shadow
コード例 #2
0
 def _get_raw_shadow(self):
     target_img = self.target.get_image(self.capture_state)
     r = target_img.get_rect()
     #the shadow will be larger in order to make free space for fadeout.
     r.inflate_ip(2 * self.shadow_radius, 2 * self.shadow_radius)
     img = Surface(r.size)
     img.fill((255, 255, 255, 255))
     img.blit(target_img, (self.shadow_radius, self.shadow_radius))
     if self.sun_angle <= 0.:
         raise Exception("Sun angle must be greater than zero.")
     elif self.sun_angle != 45. and self.vertical:
         w, h = img.get_size()
         new_h = h / tan(self.sun_angle * pi / 180.)
         screen_size = functions.get_screen().get_size()
         new_h = abs(int(min(new_h, max(screen_size))))
         img = scale(img, (w, new_h))
     if self.angle_mode == "flip":
         img = flip(img, self.mode_value[0], self.mode_value[1])
     elif self.angle_mode == "rotate":
         img = rotate(img, self.mode_value)
     else:
         raise Exception("angle_mode not available: " +
                         str(self.angle_mode))
     shadow = pilgraphics.get_shadow(img,
                                     radius=self.shadow_radius,
                                     black=self.black,
                                     alpha_factor=self.alpha_factor,
                                     decay_mode=self.decay_mode,
                                     color=self.color)
     return shadow
コード例 #3
0
ファイル: _halo.py プロジェクト: Qwebeck/pacman
 def _get_raw_shadow(self):
     target_img = self.target.get_image(self.capture_state)
     r = target_img.get_rect()
     #the shadow will be larger in order to make free space for fadeout.
     r.inflate_ip(2*self.shadow_radius, 2*self.shadow_radius)
     img = Surface(r.size)
     img.fill((255, 255, 255, 255))
     img.blit(target_img, (self.shadow_radius, self.shadow_radius))
     shadow = pilgraphics.get_shadow(img,
                                     radius=self.shadow_radius,
                                     black=self.black,
                                     alpha_factor=self.alpha_factor,
                                     decay_mode=self.decay_mode,
                                     color=self.color)
     return shadow
コード例 #4
0
ファイル: _halo.py プロジェクト: YannThorimbert/ThorPy-1.0
 def _get_raw_shadow(self):
     target_img = self.target.get_image(self.capture_state)
     r = target_img.get_rect()
     #the shadow will be larger in order to make free space for fadeout.
     r.inflate_ip(2*self.shadow_radius, 2*self.shadow_radius)
     img = Surface(r.size)
     img.fill((255, 255, 255, 255))
     img.blit(target_img, (self.shadow_radius, self.shadow_radius))
     shadow = pilgraphics.get_shadow(img,
                                     radius=self.shadow_radius,
                                     black=self.black,
                                     alpha_factor=self.alpha_factor,
                                     decay_mode=self.decay_mode,
                                     color=self.color)
     return shadow
コード例 #5
0
def get_not_already_illuminated_title(hoverable, state, color=None):
    color = style.COLOR_TXT_HOVER if color is None else color
    #produce illumination then blit it on the painter not fusionned.
    fusionner = hoverable._states[state].fusionner
    target_img = hoverable.get_image(state)
    r = target_img.get_rect()
    #the shadow will be larger in order to make free space for fadeout.
    shadow_radius = 2
    r.inflate_ip(2*shadow_radius, 2*shadow_radius)
    img = Surface(r.size)
    img.fill((255, 255, 255, 255))
    img.blit(target_img, (shadow_radius, shadow_radius))
    shadow = pilgraphics.get_shadow(img,
                                    radius=shadow_radius,
                                    black=255,
                                    alpha_factor=0.95,
                                    decay_mode="exponential",
                                    color=color)
    shadow = shadow.subsurface(shadow.get_rect().inflate((-2*shadow_radius, -2*shadow_radius)))
    return shadow
コード例 #6
0
def get_not_already_illuminated_title(hoverable, state, color=None):
    color = style.COLOR_TXT_HOVER if color is None else color
    #produce illumination then blit it on the painter not fusionned.
    fusionner = hoverable._states[state].fusionner
    target_img = hoverable.get_image(state)
    r = target_img.get_rect()
    #the shadow will be larger in order to make free space for fadeout.
    shadow_radius = 2
    r.inflate_ip(2*shadow_radius, 2*shadow_radius)
    img = Surface(r.size)
    img.fill((255, 255, 255, 255))
    img.blit(target_img, (shadow_radius, shadow_radius))
    shadow = pilgraphics.get_shadow(img,
                                    radius=shadow_radius,
                                    black=255,
                                    alpha_factor=0.95,
                                    decay_mode="exponential",
                                    color=color)
    shadow = shadow.subsurface(shadow.get_rect().inflate((-2*shadow_radius, -2*shadow_radius)))
    return shadow