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


Python Images.rotate方法代码示例

本文整理汇总了Python中Images.rotate方法的典型用法代码示例。如果您正苦于以下问题:Python Images.rotate方法的具体用法?Python Images.rotate怎么用?Python Images.rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Images的用法示例。


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

示例1: load_images_for

# 需要导入模块: import Images [as 别名]
# 或者: from Images import rotate [as 别名]
 def load_images_for(self, directory):
     img_idle_l = Images.load_imageurl("img/player/" + directory + "/idle.png")
     img_idle_r = Images.flip_horizontal(img_idle_l)
     imgs_idle = (img_idle_l, img_idle_r)
     img_swim_1_l = Images.load_imageurl("img/player/" + directory + "/swim1.png")
     img_swim_1_u = Images.rotate(img_swim_1_l, -90)
     img_swim_1_r = Images.flip_horizontal(img_swim_1_l)
     img_swim_1_d = Images.rotate(img_swim_1_l, 90)
     imgs_swim_1 = (img_swim_1_l, img_swim_1_u, img_swim_1_r, img_swim_1_d)
     img_swim_2_l = Images.load_imageurl("img/player/" + directory + "/swim2.png")
     img_swim_2_u = Images.rotate(img_swim_2_l, -90)
     img_swim_2_r = Images.flip_horizontal(img_swim_2_l)
     img_swim_2_d = Images.rotate(img_swim_2_l, 90)
     imgs_swim_2 = (img_swim_2_l, img_swim_2_u, img_swim_2_r, img_swim_2_d)
     return (imgs_idle, imgs_swim_1, imgs_swim_2)
开发者ID:kaikue,项目名称:Oceania,代码行数:17,代码来源:Player.py

示例2: load_items

# 需要导入模块: import Images [as 别名]
# 或者: from Images import rotate [as 别名]
def load_items():
    items_file = open("items.json", "r")
    global items
    items = json.load(items_file)
    items_file.close()
    for itemname in items.keys():
        item = items[itemname]
        item["can_place"] = False
        if "class" not in item.keys():
            item["class"] = "ItemStack"
        if isinstance(item["description"], str):
            item["description"] = [item["description"]]
        img = Images.load_imageurl(item["image"])
        
        img_rotated = Images.rotate(img, 90)
        item_images[itemname] = [img,
                                Images.flip_horizontal(img),
                                img_rotated,
                                Images.flip_horizontal(img_rotated),
                                Images.flip_completely(img)]
开发者ID:kaikue,项目名称:Oceania,代码行数:22,代码来源:World.py

示例3: load_image

# 需要导入模块: import Images [as 别名]
# 或者: from Images import rotate [as 别名]
 def load_image(self):
     self.img = None
     self.imgs = []
     img = pygame.Surface((Game.BLOCK_SIZE * 3, Game.BLOCK_SIZE * 3), pygame.SRCALPHA, 32).convert_alpha() #not game scale
     center = img.get_rect().center
     #TODO: blit small diagonal arm image on img (after blitting item? but before rotation)
     if self.item is not None:
         #TODO: self.item may be a dummy pickled object that hasn't been loaded- what should we do?
         #does the parent reference also get lost? that would be bad
         #self.item.load_image()
         item_img = self.item.imgs[0]
         item_img = Images.scale(item_img, 1 / Game.SCALE)
         img.blit(item_img, (0, 0))
     start_deg = math.degrees(self.angle_start - 2 * self.angle_mid)
     end_deg = math.degrees(self.angle_end - 2 * self.angle_mid)
     for i in range(0, self.max_decay + 1, FRAME_LENGTH):
         t = (self.max_decay - i) / self.max_decay
         angle = (1 - t) * start_deg + t * end_deg + 225
         rotated_img = Images.rotate(img, angle)
         rotated_img.get_rect().center = center
         self.imgs.append(Images.scale(rotated_img, Game.SCALE))
开发者ID:kaikue,项目名称:Oceania,代码行数:23,代码来源:DamageSourceSweep.py


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