예제 #1
0
 def set_clip_state(self, state):
     _state = gallium.Clip()
     _state.nr = state.nr
     if state.nr:
         # FIXME
         ucp = gallium.FloatArray(gallium.PIPE_MAX_CLIP_PLANES*4)
         for i in range(len(state.ucp)):
             for j in range(len(state.ucp[i])):
                 ucp[i*4 + j] = state.ucp[i][j]
         _state.ucp = ucp
     self.real.set_clip(_state)
예제 #2
0
def make_image(surface):
    pixels = gallium.FloatArray(surface.height*surface.width*4)
    surface.get_tile_rgba(0, 0, surface.width, surface.height, pixels)

    import Image
    outimage = Image.new(
        mode='RGB',
        size=(surface.width, surface.height),
        color=(0,0,0))
    outpixels = outimage.load()
    for y in range(0, surface.height):
        for x in range(0, surface.width):
            offset = (y*surface.width + x)*4
            r, g, b, a = [int(pixels[offset + ch]*255) for ch in range(4)]
            outpixels[x, y] = r, g, b
    return outimage
예제 #3
0
 def clear(self, buffers, rgba, depth, stencil):
     _rgba = gallium.FloatArray(4)
     for i in range(4):
         _rgba[i] = rgba[i]
     self.real.clear(buffers, _rgba, depth, stencil)
예제 #4
0
 def clear_render_target(self, dst, rgba, dstx, dsty, width, height):
     _rgba = gallium.FloatArray(4)
     for i in range(4):
         _rgba[i] = rgba[i]
     self.real.clear_render_target(dst, _rgba, dstx, dsty, width, height)