Beispiel #1
0
 def test_new(self):
     img = Image.new(RGBA, 5, 5, Black)
     self.assertImage(img, [
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
     ])
Beispiel #2
0
 def test_new(self):
     img = Image.new(5, 5, Black, RGBA)
     self.assertImage(img, [
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         [Black, Black, Black, Black, Black],
         ])
Beispiel #3
0
                psd.header.height - (layer.bbox.y1 + start[1])
            )
            angle = math.atan2(start[1] - end[1], start[0] - end[0]) - 1.570796
            offsets.write(
                "    Offset { pos: Vec2::<GLfloat> { x: %i.0, y: %i.0 }, angle: %f },\n" % (abs_pos[0], abs_pos[1], angle)
            )

        if x + psd.header.width > width:
            y += psd.header.height
            x = 0
        else:
            x += psd.header.width

    offsets.write("];\n")
else:
    atlas = Image.new(colors.RGBA, width, height, Color.from_hexcode("#00000000"))

    metadata_filename = outpath + ".info"
    metadata = open(metadata_filename, "w")
    currentframe = None

    for name, number, index, layer in frames:
        if name != currentframe:
            currentframe = name
            metadata.write("%s frame %i offset = %i\n" % (name, number, index))

        atlas.blit(y + layer.bbox.y1, x + layer.bbox.x1, layer.as_pymaging())

        if x + psd.header.width > width:
            y += psd.header.height
            x = 0
Beispiel #4
0
                # NOTE game coords start from bottom left instead of top left
                psd.header.height - (layer.bbox.y1 + start[1]))
            angle = math.atan2(start[1] - end[1], start[0] - end[0]) - 1.570796
            offsets.write(
                "    Offset { pos: Vec2::<GLfloat> { x: %i.0, y: %i.0 }, angle: %f },\n"
                % (abs_pos[0], abs_pos[1], angle))

        if x + psd.header.width > width:
            y += psd.header.height
            x = 0
        else:
            x += psd.header.width

    offsets.write("];\n")
else:
    atlas = Image.new(colors.RGBA, width, height,
                      Color.from_hexcode("#00000000"))

    metadata_filename = outpath + ".info"
    metadata = open(metadata_filename, "w")
    currentframe = None

    for name, number, index, layer in frames:
        if name != currentframe:
            currentframe = name
            metadata.write("%s frame %i offset = %i\n" % (name, number, index))

        atlas.blit(y + layer.bbox.y1, x + layer.bbox.x1, layer.as_pymaging())

        if x + psd.header.width > width:
            y += psd.header.height
            x = 0