当前位置: 首页>>代码示例>>Python>>正文


Python transform.smoothscale函数代码示例

本文整理汇总了Python中pygame.transform.smoothscale函数的典型用法代码示例。如果您正苦于以下问题:Python smoothscale函数的具体用法?Python smoothscale怎么用?Python smoothscale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了smoothscale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_subimage

 def update_subimage(self, subimg):
     self.subImg = image.load(util.enums.RES + subimg).convert_alpha()
     if self.upgrade:
         self.subImg = transform.smoothscale(self.subImg, (37, 32))
     else:
         self.subImg = transform.smoothscale(self.subImg, (37, 32))
     self.draw_subimg()
开发者ID:ROBOMonkeys,项目名称:tower-defense-game,代码行数:7,代码来源:interfaces.py

示例2: update

	def update(self):
		# First, shrink it to match res of lolshield:
		smoothscale(self.surface, (SerialShield.width, SerialShield.height), self.lol_surface)
		# clear screen (to paint leds)
		self.surface.fill(Color('black'))
		# extract value data to send:
		for x in range(SerialShield.width):
			for y in range(SerialShield.height):
				h, s, v, a, = self.lol_surface.get_at((x, y, ))
				self.set_pixel(x, y, v >= 50)
开发者ID:emdete,项目名称:lolpaint,代码行数:10,代码来源:pygamedemo.py

示例3: test_varied_smoothscale

def test_varied_smoothscale(surface):
    """Scale with more varies factors"""
    obj = _make_object()

    transform.set_smoothscale_backend('GENERIC')

    surface.blit(obj, (20, 20))
    obj1 = transform.smoothscale(obj, (25, 55))
    surface.blit(obj1, (80, 80))
    obj1 = transform.smoothscale(obj, (14, 13))
    surface.blit(obj1, (160, 160))
    obj1 = transform.smoothscale(obj, (72, 68))
    surface.blit(obj1, (320, 320))
开发者ID:CTPUG,项目名称:pygame_cffi,代码行数:13,代码来源:test_smoothscale.py

示例4: game_loop

 def game_loop(self):
     maquina_estados = self.fsm_loop()
     for estado in maquina_estados:
         for e in pygame.event.get():
             self.input(e)
         if Game.situacao[5] == -1: self.end_game()
         estado()
         if self.fullscreen:
             smoothscale(self.screen, self.f_size, self.scaled)
             self.f_screen.blit(self.scaled, (self.px,0))
         else:
             self.f_screen.blit(self.screen, (0,0))
         pygame.display.flip()
         pygame.time.wait(20)
开发者ID:robsonfr,项目名称:atac-py,代码行数:14,代码来源:__init__.py

示例5: test_int_smoothscale

def test_int_smoothscale(surface):
    """Simple integer scaling tests"""
    obj = _make_object()

    transform.set_smoothscale_backend('GENERIC')

    surface.blit(obj, (20, 20))
    obj1 = transform.smoothscale(obj, (20, 20))
    surface.blit(obj1, (60, 60))
    obj1 = transform.smoothscale(obj, (40, 40))
    surface.blit(obj1, (80, 80))
    obj1 = transform.smoothscale(obj, (60, 60))
    surface.blit(obj1, (160, 160))
    obj1 = transform.smoothscale(obj, (120, 120))
    surface.blit(obj1, (320, 320))
开发者ID:berteaa,项目名称:pygame_cffi,代码行数:15,代码来源:test_smoothscale.py

示例6: get_aa_round_rect

def get_aa_round_rect(size, radius, color):
    surface = Surface(size, flags=SRCALPHA).convert_alpha()
    rect = Rect((0, 0), size)
    color = Color(*color)
    alpha = color.a
    color.a = 0
    rectangle = Surface(size, SRCALPHA)
    #here 5 is an arbitrary multiplier, we will just rescale later
    circle = Surface([min(size) * 5, min(size) * 5], SRCALPHA)
    draw.ellipse(circle, (0,0,0), circle.get_rect(), 0)
    circle = transform.smoothscale(circle, (2*radius, 2*radius))
    #now circle is just a small circle of radius
    #blit topleft circle:
    radius_rect = rectangle.blit(circle, (0, 0))
    #now radius_rect = Rect((0, 0), circle.size), rect=Rect((0, 0), size)
    #blit bottomright circle:
    radius_rect.bottomright = rect.bottomright #radius_rect is growing
    rectangle.blit(circle, radius_rect)
    #blit topright circle:
    radius_rect.topright = rect.topright
    rectangle.blit(circle, radius_rect)
    #blit bottomleft circle:
    radius_rect.bottomleft = rect.bottomleft
    rectangle.blit(circle, radius_rect)
    #black-fill of the internal rect
    rectangle.fill((0, 0, 0), rect.inflate(-radius_rect.w, 0))
    rectangle.fill((0, 0, 0), rect.inflate(0, -radius_rect.h))
    #fill with color using blend_rgba_max
    rectangle.fill(color, special_flags=BLEND_RGBA_MAX)
    #fill with alpha-withe using blend_rgba_min in order to make transparent
    #the
    rectangle.fill((255, 255, 255, alpha), special_flags=BLEND_RGBA_MIN)
    surface.blit(rectangle, rect.topleft)
    return surface
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:34,代码来源:graphics.py

示例7: render

 def render(self):
     # ~ draw magnetradius
     if self.magnetradius:
         # ~ gfxdraw.aacircle(scr,self.centerx,self.centery,int(self.magnetradius),(150,130,110,int(self.magnetradius)))
         m = image.load("img/magnetichalo.png")
         m = transform.smoothscale(m, [int(self.magnetradius * 2)] * 2)
         scr.blit(m, m.get_rect(center=self.center))
     # ~ draw shieldbar
     r = draw.rect(scr, (50, 50, 50), (10, 500, 380, 18), 1)
     osdlayer.fill((100, 100, 200, self.shieldfxttl * 4 + 150), (10, 0, self.shield_ / self.shieldmax * 380, 18))
     # scr.blit(self.SHIELDTEXT,self.SHIELDRECT)
     # ~ draw lazerstate
     r = draw.rect(scr, (50, 50, 50), (10, 520, 380, 18), 1)
     osdlayer.blit(self.lazertempfx, (10, 20), (0, 0, DoubleLazer.temper / DoubleLazer.tempmax * 380, 18))
     # scr.blit(self.LAZERTEXT,self.LAZERRECT)
     # ~ draw bonusbar
     self.settingbonus_.render()
     self.loader1_.render()
     # ~ draw shieldcircle
     if self.shieldfxttl:
         self.shieldcolor.a = int(4 * self.shieldfxttl)
         gfxdraw.filled_circle(scr, self.centerx, self.centery, self.w, self.shieldcolor)
         self.shieldfxttl -= 1
     if self.foo:
         self.foo -= 1
         scr.blit(self.img2, ship)
         return
     # ~ draw ship
     scr.blit(self.img, ship)
开发者ID:strin,项目名称:curriculum-deep-RL,代码行数:29,代码来源:ship.py

示例8: render

def render(text, font, background, color, left, top, width, height) : 
		text_rendered = font.render(text, 1, color)
		text_height = font.get_ascent()
		text_rendered = text_rendered.subsurface(Rect(0, (text_rendered.get_height() - text_height) / 2 , text_rendered.get_width(), text_height))
		rect_rendered = text_rendered.get_rect()
#		final_rect = pygame.Rect(left, top, width, height).fit(rect_rendered)
		final_rect = rect_rendered.fit(Rect(left, top, width, height))
		background.blit(transform.smoothscale(text_rendered, (final_rect.width, final_rect.height)), Rect(left, top, final_rect.width, final_rect.height))
开发者ID:konfiot,项目名称:PRoq,代码行数:8,代码来源:render.py

示例9: scale

 def scale(self, size):
     # Used for changing word size
     pos = (self.rect.x, self.rect.y)
     self.image = transform.smoothscale(self.image, (int(self.rect.width*size), int(self.rect.height*size)))
     self.msf = transform.scale(self.msf, (int(self.rect.width*size), int(self.rect.height*size)))
     self.rect = self.image.get_rect()
     self.rect.x, self.rect.y = pos
     self._update_mask()
开发者ID:nullicorn,项目名称:scwordcloudapp,代码行数:8,代码来源:word.py

示例10: test_y_smoothscale

def test_y_smoothscale(surface):
    """Scale y axis only"""
    obj = _make_object()

    transform.set_smoothscale_backend('GENERIC')

    surface.blit(obj, (20, 20))
    obj1 = transform.smoothscale(obj, (20, 25))
    surface.blit(obj1, (80, 80))
    obj2 = transform.smoothscale(obj, (20, 35))
    surface.blit(obj2, (160, 160))
    obj3 = transform.smoothscale(obj, (20, 55))
    surface.blit(obj3, (240, 160))
    obj4 = transform.smoothscale(obj, (20, 15))
    surface.blit(obj4, (240, 240))
    obj5 = transform.smoothscale(obj, (20, 100))
    surface.blit(obj5, (320, 320))
开发者ID:CTPUG,项目名称:pygame_cffi,代码行数:17,代码来源:test_smoothscale.py

示例11: __init__

    def __init__(self, model):
        self.id = 'Projectile'

        self.size = (model.radius*2, model.radius*2)

        self.base_image = load_image('planet.png')
        self.image = smoothscale(self.base_image, self.size)

        self.model = model
开发者ID:dmalves,项目名称:galgrav,代码行数:9,代码来源:sprites.py

示例12: get_plant_thumbnail

def get_plant_thumbnail(plant, size):
	#print "get_plant_thumbnail:", plant, size ###
	thumb = plant._thumbnail
	if not thumb:
		#print "get_plant_thumbnail: generating thumbnail" ###
		buffer = render_plant(plant, (600, 600))
		thumb = transform.smoothscale(buffer, size)
		plant._thumbnail = thumb
	return thumb
开发者ID:wolmir,项目名称:cristina,代码行数:9,代码来源:rendering.py

示例13: get_border

 def get_border(self):
     '''if self.model.lockdown_frames > 180:
         return smoothscale(self.border4, self.size)
     elif self.model.lockdown_frames > 120:
         return smoothscale(self.border3, self.size)
     elif self.model.lockdown_frames > 60:
         return smoothscale(self.border2, self.size)
     else:
         return smoothscale(self.border1, self.size)'''
     return smoothscale(self.border4, self.size)
开发者ID:dmalves,项目名称:galgrav,代码行数:10,代码来源:sprites.py

示例14: test_subsurface_smoothscale

def test_subsurface_smoothscale(surface):
    """Test scaling a small subsurface"""
    obj = _make_object()

    transform.set_smoothscale_backend('GENERIC')

    obj_sub = obj.subsurface((20, 20, 20, 25))

    surface.blit(obj, (20, 20))
    surface.blit(obj_sub, (60, 20))
    obj1 = transform.smoothscale(obj_sub, (obj_sub.get_width(), obj_sub.get_height()))
    surface.blit(obj1, (120, 20))
    obj1 = transform.smoothscale(obj_sub, (20, 20))
    surface.blit(obj1, (60, 60))
    obj1 = transform.smoothscale(obj_sub, (40, 40))
    surface.blit(obj1, (80, 80))
    obj1 = transform.smoothscale(obj_sub, (60, 60))
    surface.blit(obj1, (160, 160))
    obj1 = transform.smoothscale(obj_sub, (120, 120))
    surface.blit(obj1, (220, 220))
开发者ID:caseyc37,项目名称:pygame_cffi,代码行数:20,代码来源:test_smoothscale.py

示例15: __call__

    def __call__(self, x, y, w, h):
        if not x in self.cache:
            self.cache[x] = {}
        if not y in self.cache[x]:
            self.cache[x][y] = {}
        if not w in self.cache[x][y]:
            self.cache[x][y][w] = {}
        if not h in self.cache[x][y][w]:
            self.cache[x][y][w][h] = transform.smoothscale(self.sprites(x, y), (w, h))

        return self.cache[x][y][w][h]
开发者ID:roSievers,项目名称:Orbital4,代码行数:11,代码来源:spriteSheet.py


注:本文中的pygame.transform.smoothscale函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。