def IVectorView(T): cls = pinterface_type('IVectorView', 'bbe1fa4c-b0e3-4583-baef-1f1b2e483e56', (T,), (IIterable(T), IVectorView_helpers)) define_winrt_com_method(cls, 'GetAt', c_uint, retval=T, vtbl=6) define_winrt_com_method(cls, 'get_Size', propget=c_uint32, vtbl=7) define_winrt_com_method(cls, 'IndexOf', T, POINTER(c_uint32), retval=c_bool, vtbl=8) define_winrt_com_method(cls, 'GetMany', c_uint, c_uint, POINTER(IInspectable), POINTER(c_uint), vtbl=9) return cls
def IIterator(T): cls = pinterface_type('IIterator', '6a79e863-4300-459a-9966-cbb660963ee1', (T,), (IInspectable, IIterator_helpers)) define_winrt_com_method(cls, 'get_Current', propget=T, vtbl=6) define_winrt_com_method(cls, 'get_HasCurrent', propget=c_bool, vtbl=7) define_winrt_com_method(cls, 'MoveNext', retval=c_bool, vtbl=8) define_winrt_com_method(cls, 'GetMany', c_uint, POINTER(T), POINTER(c_uint), retval=c_uint32, vtbl=9) return cls
def IAsyncOperation(T): cls = pinterface_type('IAsyncOperation', '9fc2b0bb-e446-44e2-aa61-9cab8f636af2', (T,), (IAsyncInfo, IAsyncOperation_helpers)) IAsyncOperation.known_types[(T,)] = cls define_winrt_com_method(cls, 'put_Completed', propput=AsyncOperationCompletedHandler(T), vtbl=6) define_winrt_com_method(cls, 'get_Completed', propget=AsyncOperationCompletedHandler(T), vtbl=7) define_winrt_com_method(cls, 'GetResults', retval=T, vtbl=8) return cls
from ctypes import c_uint32, c_void_p import rotypes.Windows.Storage.Streams from rotypes.idldsl import define_winrt_com_method, _non_activatable_init, _static_method, runtimeclass, GUID from rotypes.inspectable import IInspectable @GUID('320B7E22-3CB0-4CDF-8663-1D28910065EB') class ICryptographicBufferStatics(IInspectable): pass class CryptographicBuffer(runtimeclass): __init__ = _non_activatable_init CreateFromByteArray = _static_method(ICryptographicBufferStatics, 'CreateFromByteArray') define_winrt_com_method(ICryptographicBufferStatics, 'CreateFromByteArray', c_uint32, c_void_p, retval=rotypes.Windows.Storage.Streams.IBuffer, vtbl=9)
from rotypes.inspectable import IInspectable from rotypes.idldsl import define_winrt_com_method, runtimeclass, _static_method from rotypes.winstring import HSTRING class ILanguage(IInspectable): IID = 'EA79A752-F7C2-4265-B1BD-C4DEC4E4F080' class ILanguageFactory(IInspectable): IID = '9B0252AC-0C27-44F8-B792-9793FB66C63E' class Language(runtimeclass, ILanguage): CreateLanguage = _static_method(ILanguageFactory, 'CreateLanguage') define_winrt_com_method(ILanguage, 'get_LanguageTag', propget=HSTRING, vtbl=6) define_winrt_com_method(ILanguage, 'get_DisplayName', propget=HSTRING, vtbl=7) define_winrt_com_method(ILanguage, 'get_NativeName', propget=HSTRING, vtbl=8) define_winrt_com_method(ILanguage, 'get_Script', propget=HSTRING, vtbl=9) define_winrt_com_method(ILanguageFactory, 'CreateLanguage', HSTRING, retval=Language, vtbl=6)
pass class BitmapPixelFormat(c_int): Rgba8 = 30 class BitmapAlphaMode(c_int): Straight = 1 @GUID('DF0385DB-672F-4A9D-806E-C2442F343E86') class ISoftwareBitmapStatics(IInspectable): pass class SoftwareBitmap(runtimeclass, ISoftwareBitmap): CreateCopyWithAlphaFromBuffer = _static_method( ISoftwareBitmapStatics, 'CreateCopyWithAlphaFromBuffer') define_winrt_com_method(ISoftwareBitmapStatics, "CreateCopyWithAlphaFromBuffer", rotypes.Windows.Storage.Streams.IBuffer, BitmapPixelFormat, c_int32, c_int32, BitmapAlphaMode, retval=SoftwareBitmap, vtbl=10)
def IReference(T): cls = pinterface_type('IReference', '61c17706-2d65-11e0-9ae8-d48564015472', (T, ), (IInspectable, )) IAsyncOperation.known_types[(T, )] = cls define_winrt_com_method(cls, 'get_Value', propget=T, vtbl=6) return cls
cls = pinterface_type('IReference', '61c17706-2d65-11e0-9ae8-d48564015472', (T, ), (IInspectable, )) IAsyncOperation.known_types[(T, )] = cls define_winrt_com_method(cls, 'get_Value', propget=T, vtbl=6) return cls class IClosable(IInspectable): IID = '30d5a829-7fa4-4026-83bb-d75bae4ea99e' def __exit__(self, exc_type, exc_val, exc_tb): self.Close() class IStringable(IInspectable): IID = '96369f54-8eb6-48f0-abce-c1b211e627c3' def __str__(self): return str(self.ToString()) define_winrt_com_method(IAsyncInfo, 'get_Id', propget=c_uint32) define_winrt_com_method(IAsyncInfo, 'get_Status', propget=c_int) define_winrt_com_method(IAsyncInfo, 'get_ErrorCode', propget=HRESULT) define_winrt_com_method(IAsyncInfo, 'Cancel') define_winrt_com_method(IAsyncInfo, 'Close') define_winrt_com_method(IClosable, 'Close', vtbl=6) define_winrt_com_method(IStringable, 'ToString', vtbl=6)
from ctypes import c_uint32, c_void_p, string_at from rotypes.idldsl import define_winrt_com_method from rotypes.inspectable import IInspectable, IUnknown class IBufferByteAccess(IUnknown): IID = '905a0fef-bc53-11df-8c49-001e4fc686da' class IBuffer(IInspectable): IID = '905A0FE0-BC53-11DF-8C49-001E4FC686DA' def __len__(self): return self.Length def __bytes__(self): byteaccess = self.astype(IBufferByteAccess) ptr = byteaccess.Buffer() return string_at(ptr, len(self)) define_winrt_com_method(IBufferByteAccess, 'Buffer', retval=c_void_p) define_winrt_com_method(IBuffer, 'get_Capacity', propget=c_uint32) define_winrt_com_method(IBuffer, 'get_Length', propget=c_uint32) define_winrt_com_method(IBuffer, 'put_Length', propput=c_uint32)
class Direct3D11CaptureFramePool(runtimeclass, IDirect3D11CaptureFramePool, IClosable): pass class GraphicsCaptureItem(runtimeclass, IGraphicsCaptureItem): pass class GraphicsCaptureSession(runtimeclass, IGraphicsCaptureSession, IGraphicsCaptureSession2, IClosable): pass define_winrt_com_method(IDirect3D11CaptureFrame, 'get_Surface', propget=IInspectable) define_winrt_com_method(IDirect3D11CaptureFrame, 'get_SystemRelativeTime', propget=c_int64) #FIXME: Windows.Foundation.TimeSpan define_winrt_com_method(IDirect3D11CaptureFrame, 'get_ContentSize', propget=SizeInt32) define_winrt_com_method( IDirect3D11CaptureFramePool, 'Recreate', IInspectable['Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice'], DirectXPixelFormat, c_int32, SizeInt32) #FIXME: Windows.Graphics.DirectX.DirectXPixelFormat define_winrt_com_method(IDirect3D11CaptureFramePool, 'TryGetNextFrame',
def IIterable(T): cls = pinterface_type('IIterable', 'faa585ea-6214-4217-afda-7f46de5869b3', (T,), (IInspectable, IIterable_helpers)) define_winrt_com_method(cls, 'get_First', propget=IIterator(T), vtbl=6) return cls
class OcrEngine(runtimeclass, IOcrEngine): __init__ = _non_activatable_init MaxImageDimension = _static_propget(IOcrEngineStatics, 'MaxImageDimension') AvailableRecognizerLanguages = _static_propget( IOcrEngineStatics, 'AvailableRecognizerLanguages') IsLanguageSupported = _static_method(IOcrEngineStatics, 'IsLanguageSupported') TryCreateFromLanguage = _static_method(IOcrEngineStatics, 'TryCreateFromLanguage') TryCreateFromUserProfileLanguages = _static_method( IOcrEngineStatics, 'TryCreateFromUserProfileLanguages') define_winrt_com_method(IOcrWord, 'get_BoundingRect', propget=Rect, vtbl=6) define_winrt_com_method(IOcrWord, 'get_Text', propget=HSTRING, vtbl=7) define_winrt_com_method(IOcrLine, 'get_Words', propget=IVectorView(OcrWord), vtbl=6) define_winrt_com_method(IOcrLine, 'get_Text', propget=HSTRING, vtbl=7) define_winrt_com_method(IOcrResult, 'get_Lines', propget=IVectorView(OcrLine), vtbl=6) define_winrt_com_method(IOcrResult, 'get_TextAngle', propget=IReference(c_double),
class D3D11_MAPPED_SUBRESOURCE(ctypes.Structure): _fields_ = [ ('pData', ctypes.c_void_p), ('RowPitch', ctypes.wintypes.UINT), ('DepthPitch', ctypes.wintypes.UINT) ] @idldsl.GUID('db6f6ddb-ac77-4e88-8253-819df9bbf140') class ID3D11Device(IUnknown): pass @idldsl.GUID('6f15aaf2-d208-4e89-9ab4-489535d34f9c') class ID3D11Texture2D(IUnknown): pass @idldsl.GUID('c0bfa96c-e089-44fb-8eaf-26f8796190da') class ID3D11DeviceContext(IUnknown): pass idldsl.define_winrt_com_method(ID3D11Device, 'CreateTexture2D', ctypes.POINTER(D3D11_TEXTURE2D_DESC), ctypes.c_void_p, retval=ID3D11Texture2D, vtbl=5) idldsl.define_winrt_com_method(ID3D11Device, 'GetImmediateContext', retval=ID3D11DeviceContext, vtbl=40) # idldsl.define_winrt_com_method(ID3D11Texture2D, 'GetDevice', retval=ID3D11Texture2D, vtbl=3) idldsl.define_winrt_com_method(ID3D11Texture2D, 'GetDesc', retval=D3D11_TEXTURE2D_DESC, vtbl=10) idldsl.define_winrt_com_method(ID3D11DeviceContext , 'Map', IUnknown, ctypes.c_uint, ctypes.c_int, ctypes.c_uint, retval=D3D11_MAPPED_SUBRESOURCE, vtbl=14) idldsl.define_winrt_com_method(ID3D11DeviceContext , 'Unmap', IUnknown, ctypes.c_uint, vtbl=15) idldsl.define_winrt_com_method(ID3D11DeviceContext , 'CopyResource', IUnknown, IUnknown, vtbl=47) D3D11CreateDevice = ctypes.oledll.d3d11.D3D11CreateDevice D3D11CreateDevice.argtypes = (IUnknown, ctypes.c_int, ctypes.c_void_p, ctypes.wintypes.UINT, ctypes.c_void_p, ctypes.c_uint, ctypes.c_uint, ID3D11Device, ctypes.c_void_p, ID3D11DeviceContext)