# Path: tilenol/xcb/pixbuf.py
# class PixbufBase(object):
# 
#     def __init__(self, image, xcore):
#         self._image = image
#         self.width = image.get_width()
#         self.height = image.get_height()
#         self._context = cairo.Context(self._image)
#         self.xcore = xcore
# 
#     def context(self):
#         return self._context


import cairo
import ctypes
from .pixbuf import PixbufBase



IPC_CREAT = 0o1000
IPC_PRIVATE = 0
IPC_RMID = 0
SHM_RDONLY = 0o10000
SHM_RND = 0o20000
SHM_REMAP = 0o40000
SHM_EXEC = 0o100000

try:
    rt = ctypes.CDLL('librt.so', use_errno=True)
    shmget = rt.shmget
    shmget.argtypes = [ctypes.c_int, ctypes.c_size_t, ctypes.c_int]
    shmget.restype = ctypes.c_int
    shmat = rt.shmat
    shmat.argtypes = [ctypes.c_int,
                      ctypes.POINTER(ctypes.c_void_p), ctypes.c_int]
    shmat.restype = ctypes.c_void_p
    shmdt = rt.shmdt
    shmdt.argtypes = [ctypes.c_void_p]
    shmdt.restype = ctypes.c_int
    shmctl = rt.shmctl
    shmctl.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_void_p]
    shmctl.restype = ctypes.c_int
except (OSError, AttributeError):
    raise ImportError("Shared memory is not supported")



# Path: tilenol/xcb/pixbuf.py
# class PixbufBase(object):
# 
#     def __init__(self, image, xcore):
#         self._image = image
#         self.width = image.get_width()
#         self.height = image.get_height()
#         self._context = cairo.Context(self._image)
#         self.xcore = xcore
# 
#     def context(self):
#         return self._context


# Path: tilenol/xcb/shm.py
import cairo
import ctypes
from .pixbuf import PixbufBase




IPC_CREAT = 0o1000
IPC_PRIVATE = 0
IPC_RMID = 0
SHM_RDONLY = 0o10000
SHM_RND = 0o20000
SHM_REMAP = 0o40000
SHM_EXEC = 0o100000

try:
    rt = ctypes.CDLL('librt.so', use_errno=True)
    shmget = rt.shmget
    shmget.argtypes = [ctypes.c_int, ctypes.c_size_t, ctypes.c_int]
    shmget.restype = ctypes.c_int
    shmat = rt.shmat
    shmat.argtypes = [ctypes.c_int,
                      ctypes.POINTER(ctypes.c_void_p), ctypes.c_int]
    shmat.restype = ctypes.c_void_p
    shmdt = rt.shmdt
    shmdt.argtypes = [ctypes.c_void_p]
    shmdt.restype = ctypes.c_int
    shmctl = rt.shmctl
    shmctl.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_void_p]
    shmctl.restype = ctypes.c_int
except (OSError, AttributeError):
    raise ImportError("Shared memory is not supported")



class ShmPixbuf(PixbufBase):