Пример #1
0
    def make_image(self):
        self.surf_regular = self.font.render(self.text,
                                             self.font_aa,
                                             self.font_color_regular)
        if self.bg_regular and not self.bg_regular == "noimage":
            new = image.resize_tile(self.bg_regular, self.surf_regular.get_size())
            a = self.surf_regular
            new.blit(a, (int(careful_div(new.get_width() - a.get_width(), 2)),
                         int(careful_div(new.get_height() - a.get_height(), 2))))
            self.surf_regular = new
        self.surf_hover = self.font.render(self.text,
                                           self.font_aa,
                                           self.font_color_hover)
        if self.bg_hover and not self.bg_hover == "noimage":
            new = image.resize_tile(self.bg_hover, self.surf_hover.get_size())
            a = self.surf_hover
            new.blit(a, (int(careful_div(new.get_width() - a.get_width(), 2)),
                         int(careful_div(new.get_height() - a.get_height(), 2))))
            self.surf_hover = new
        self.surf_click = self.font.render(self.text,
                                           self.font_aa,
                                           self.font_color_click)
        if self.bg_click  and not self.bg_click  == "noimage":
            new = image.resize_tile(self.bg_click , self.surf_click .get_size())
            a = self.surf_click
            new.blit(a, (int(careful_div(new.get_width() - a.get_width(), 2)),
                         int(careful_div(new.get_height() - a.get_height(), 2))))
            self.surf_click  = new

        self.surface = self.surf_regular
        self.make_rect()
        self.move()
Пример #2
0
    def draw(self,image,nthreads=1):
        self.init_pfunc()

        colormap = self.get_colormap()
        for (xoff,yoff,xres,yres) in image.get_tile_list():
            image.resize_tile(xres,yres)
            image.set_offset(xoff,yoff)

            self.calc(image,colormap,nthreads,self.site,False)

            image.save_tile()
Пример #3
0
 def scale_surface(self):
     if not self.surface.get_size() == (self.over_width, self.over_height):
         self.surface = image.resize_tile(self.__orig_surface, (self.over_width,
                                                                self.over_height),
                                          True)
         self.rect.size = self.over_width, self.over_height
         if self.use_pp:
             self.hitmask = rect.RectMaskCombo(self.rect, mask.from_surface(self.surface))
Пример #4
0
 def make_image(self):
     self.surface = self.font.render(self.text,
                                     self.font_aa,
                                     self.font_color)
     if self.bg_image and not self.bg_image == "noimage":
         new = image.resize_tile(self.bg_image, self.surface.get_size())
         a = self.surface
         new.blit(a, (int(careful_div(new.get_width() - a.get_width(), 2)),
                      int(careful_div(new.get_height() - a.get_height(), 2))))
         self.surface = new
     self.make_rect()
     self.move()