예제 #1
0
파일: core_graphics.py 프로젝트: pybee/toga
        ("d", CGFloat),
        ("tx", CGFloat),
        ("ty", CGFloat),
    ]


core_graphics.CGAffineTransformIdentity = CGAffineTransform
core_graphics.CGAffineTransformInvert.restype = CGAffineTransform
core_graphics.CGAffineTransformInvert.argtypes = [CGAffineTransform]
core_graphics.CGAffineTransformMakeScale.restype = CGAffineTransform
core_graphics.CGAffineTransformMakeScale.argtypes = [CGFloat, CGFloat]

######################################################################
# CGContext.h
CGContextRef = c_void_p
register_preferred_encoding(b'^{__CGContext=}', CGContextRef)

CGPathDrawingMode = c_int32
kCGPathFill = 0
kCGPathEOFill = 1
kCGPathStroke = 2
kCGPathFillStroke = 3
kCGPathEOFillStroke = 4

CGTextDrawingMode = c_int32
kCGTextFill = 0
kCGTextStroke = 1
kCGTextFillStroke = 2
kCGTextInvisible = 3
kCGTextFillClip = 4
kCGTextStrokeClip = 5
예제 #2
0
        ("d", CGFloat),
        ("tx", CGFloat),
        ("ty", CGFloat),
    ]


core_graphics.CGAffineTransformIdentity = CGAffineTransform
core_graphics.CGAffineTransformInvert.restype = CGAffineTransform
core_graphics.CGAffineTransformInvert.argtypes = [CGAffineTransform]
core_graphics.CGAffineTransformMakeScale.restype = CGAffineTransform
core_graphics.CGAffineTransformMakeScale.argtypes = [CGFloat, CGFloat]

######################################################################
# CGContext.h
CGContextRef = c_void_p
register_preferred_encoding(b'^{__CGContext=}', CGContextRef)

CGPathDrawingMode = c_int32
kCGPathFill = 0
kCGPathEOFill = 1
kCGPathStroke = 2
kCGPathFillStroke = 3
kCGPathEOFillStroke = 4

CGTextDrawingMode = c_int32
kCGTextFill = 0
kCGTextStroke = 1
kCGTextFillStroke = 2
kCGTextInvisible = 3
kCGTextFillClip = 4
kCGTextStrokeClip = 5
예제 #3
0
from enum import Enum

from rubicon.objc import *
from rubicon.objc.types import register_preferred_encoding

from toga.constants import *
from toga.constants.color import *

######################################################################
core_graphics = cdll.LoadLibrary(util.find_library('CoreGraphics'))
######################################################################

######################################################################
# CGEvent.h
CGEventRef = c_void_p
register_preferred_encoding(b'^{__CGEvent=}', CGEventRef)

CGEventSourceRef = c_void_p
register_preferred_encoding(b'^{__CGEventSource=}', CGEventSourceRef)

CGScrollEventUnit = c_uint32

core_graphics.CGEventCreateScrollWheelEvent.argtypes = [
    CGEventSourceRef, CGScrollEventUnit, c_uint32, c_int32, c_int32
]
core_graphics.CGEventCreateScrollWheelEvent.restype = CGEventRef

######################################################################
# CGEventTypes.h
kCGScrollEventUnitPixel = 0
kCGScrollEventUnitLine = 1
예제 #4
0
######################################################################

kCGBitmapByteOrderDefault = 0
kCGImageAlphaNone = 0
kCGRenderingIntentDefault = 0

######################################################################
# CoreGraphics data types
######################################################################

CGFloat = c_double
CGBitmapInfo = c_ulong
CGColorRenderingIntent = c_long

CGContextRef = c_void_p
register_preferred_encoding(b'^{__CGContext=}', CGContextRef)

CGDataProviderRef = c_void_p
register_preferred_encoding(b'^{__CGDataProvider=}', CGDataProviderRef)

CGColorSpaceRef = c_void_p
register_preferred_encoding(b'^{__CGColorSpace=}', CGColorSpaceRef)

CGImageRef = c_void_p
register_preferred_encoding(b'^{__CGImage=}', CGImageRef)

######################################################################
# CoreGraphics methods
######################################################################

core_graphics.CGDataProviderCreateWithData.argtypes = [