# Path: pyrikura/ipyrikura.py
# class IPyrikuraPlugin(Interface):
# class ITrigger(Interface):
# class IImageProcessor(Interface):
# class IFileOp(Interface):
# class ICamera(Interface):
#     def trigger(self):
#     def process(self):
#     def process(self):


from twisted.plugin import IPlugin
from twisted.internet import defer
from twisted.internet import threads
from zope.interface import implements
from pyrikura import ipyrikura
from PIL import Image
            if not result:
                raise ValueError
            config, images = values
            layers.append((config, images))

        # layers are sorted with the last items 'on top' of the final image
        layers.sort(key=lambda i: i[0]['name'])

        filename = 'composite.png'
        yield threads.deferToThread(composite, self.config, layers, filename)

        defer.returnValue(filename)

    def convert_area_pixels(self, area):
        return tuple(float(i) for i in area.split(','))

    def convert_area_inches(self, area):
        dpi = self.template.getfloat('general', 'dpi')
        return tuple(int(float(i) * dpi) for i in area.split(','))

    def process(self, filename):
        self.filename_queue.put(filename)
        if self.running:
            return None
        else:
            self.running = True
            return self.compose()


class ComposerFactory(object):

# Path: pyrikura/ipyrikura.py
# class IPyrikuraPlugin(Interface):
# class ITrigger(Interface):
# class IImageProcessor(Interface):
# class IFileOp(Interface):
# class ICamera(Interface):
#     def trigger(self):
#     def process(self):
#     def process(self):


# Path: pyrikura/twisted/plugins/composer.py
from twisted.plugin import IPlugin
from twisted.internet import defer
from twisted.internet import threads
from zope.interface import implements
from pyrikura import ipyrikura
from PIL import Image

            if not result:
                raise ValueError
            config, images = values
            layers.append((config, images))

        # layers are sorted with the last items 'on top' of the final image
        layers.sort(key=lambda i: i[0]['name'])

        filename = 'composite.png'
        yield threads.deferToThread(composite, self.config, layers, filename)

        defer.returnValue(filename)

    def convert_area_pixels(self, area):
        return tuple(float(i) for i in area.split(','))

    def convert_area_inches(self, area):
        dpi = self.template.getfloat('general', 'dpi')
        return tuple(int(float(i) * dpi) for i in area.split(','))

    def process(self, filename):
        self.filename_queue.put(filename)
        if self.running:
            return None
        else:
            self.running = True
            return self.compose()


class ComposerFactory(object):

    implements(IPlugin, ipyrikura.IPyrikuraPlugin)