Ejemplo n.º 1
0
            return
        self._filename = value
        self.svg_object = SvgLoader.load(self._filename)
    filename = property(_get_filename, _set_filename,
            doc='Get/set the filename of svg')

    def _get_scale(self):
        return self._scale_x
    def _set_scale(self, s):
        self._scale_x = s
        self._scale_y = s
    scale = property(_get_scale, _set_scale)

    def draw(self):
        '''Draw the svg on screen'''
        with gx_matrix:
            glTranslate(self.x, self.y, 0)
            glScale(self._scale_x, self._scale_y, 1)
            glTranslate(self.anchor_x, self.anchor_y, 0)
            self.svg_object.draw()

def load(filename):
    '''Load an image'''
    return Svg.load(filename)


# load image loaders
core_register_libs('svg', (
    ('squirtle', 'svg_squirtle'),
))
Ejemplo n.º 2
0
            raise EOFError('Image data is missing, make sure that image is'
                           'loaded with keep_data=True keyword.')

        # check bounds
        x, y = int(x), int(y)
        if not (0 <= x < data.width and 0 <= y < data.height):
            raise IndexError('Position (%d, %d) is out of range.' % (x, y))

        assert data.mode in ImageData._supported_modes
        size = 3 if data.mode in ('RGB', 'BGR') else 4
        index = y * data.width * size + x * size
        raw = data.data[index:index+size]
        color = map(lambda c: ord(c) / 255.0, raw)

        # conversion for BGR->RGB, BGR->RGBA format
        if data.mode in ('BGR', 'BGRA'):
            color[0], color[2] = color[2], color[0]

        return color


def load(filename):
    '''Load an image'''
    return Image.load(filename)

# load image loaders
core_register_libs('image', (
    ('pygame', 'img_pygame'),
    ('pil', 'img_pil'),
))
Ejemplo n.º 3
0
    filename = property(_get_filename,
                        _set_filename,
                        doc='Get/set the filename of svg')

    def _get_scale(self):
        return self._scale_x

    def _set_scale(self, s):
        self._scale_x = s
        self._scale_y = s

    scale = property(_get_scale, _set_scale)

    def draw(self):
        '''Draw the svg on screen'''
        with gx_matrix:
            glTranslate(self.x, self.y, 0)
            glScale(self._scale_x, self._scale_y, 1)
            glTranslate(self.anchor_x, self.anchor_y, 0)
            self.svg_object.draw()


def load(filename):
    '''Load an image'''
    return Svg.load(filename)


# load image loaders
core_register_libs('svg', (('squirtle', 'svg_squirtle'), ))
Ejemplo n.º 4
0
        pass

    def play(self):
        '''Play the file'''
        self._set_status('play')

    def stop(self):
        '''Stop playback'''
        self._set_status('stop')

    def seek(self, position):
        '''Seek to the <position> (in seconds)'''
        pass

    def on_play(self):
        pass

    def on_stop(self):
        pass


# Little trick here, don't activate gstreamer on window
# seem to have lot of crackle or something...
# XXX test in macosx
audio_libs = []
if sys.platform not in ('win32', 'cygwin'):
    audio_libs += [('gstreamer', 'audio_gstreamer')]
audio_libs += [('pygame', 'audio_pygame')]

core_register_libs('audio', audio_libs)
Ejemplo n.º 5
0
        pass

    def play(self):
        '''Play the file'''
        self._set_status('play')

    def stop(self):
        '''Stop playback'''
        self._set_status('stop')

    def seek(self, position):
        '''Seek to the <position> (in seconds)'''
        pass

    def on_play(self):
        pass

    def on_stop(self):
        pass


# Little trick here, don't activate gstreamer on window
# seem to have lot of crackle or something...
# XXX test in macosx
audio_libs = []
if sys.platform not in ('win32', 'cygwin'):
    audio_libs += [('gstreamer', 'audio_gstreamer')]
audio_libs += [('pygame', 'audio_pygame')]

core_register_libs('audio', audio_libs)
Ejemplo n.º 6
0
        self._filename = value
        self.svg_object = SvgLoader.load(self._filename)

    filename = property(_get_filename, _set_filename, doc="Get/set the filename of svg")

    def _get_scale(self):
        return self._scale_x

    def _set_scale(self, s):
        self._scale_x = s
        self._scale_y = s

    scale = property(_get_scale, _set_scale)

    def draw(self):
        """Draw the svg on screen"""
        with gx_matrix:
            glTranslate(self.x, self.y, 0)
            glScale(self._scale_x, self._scale_y, 1)
            glTranslate(self.anchor_x, self.anchor_y, 0)
            self.svg_object.draw()


def load(filename):
    """Load an image"""
    return Svg.load(filename)


# load image loaders
core_register_libs("svg", (("squirtle", "svg_squirtle"),))