mirror of https://github.com/adamdruppe/arsd.git
Merge branch 'mac'
This commit is contained in:
commit
b06d1bcb32
|
@ -2050,11 +2050,15 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
|
|
||||||
+/
|
+/
|
||||||
@property void cursor(MouseCursor cursor) {
|
@property void cursor(MouseCursor cursor) {
|
||||||
auto ch = cursor.cursorHandle;
|
version(OSXCocoa)
|
||||||
|
featureNotImplemented();
|
||||||
|
else
|
||||||
if(this.impl.curHidden <= 0) {
|
if(this.impl.curHidden <= 0) {
|
||||||
static if(UsingSimpledisplayX11) {
|
static if(UsingSimpledisplayX11) {
|
||||||
|
auto ch = cursor.cursorHandle;
|
||||||
XDefineCursor(XDisplayConnection.get(), this.impl.window, ch);
|
XDefineCursor(XDisplayConnection.get(), this.impl.window, ch);
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
|
auto ch = cursor.cursorHandle;
|
||||||
impl.currentCursor = ch;
|
impl.currentCursor = ch;
|
||||||
SetCursor(ch); // redraw without waiting for mouse movement to update
|
SetCursor(ch); // redraw without waiting for mouse movement to update
|
||||||
} else featureNotImplemented();
|
} else featureNotImplemented();
|
||||||
|
@ -12256,7 +12260,7 @@ private:
|
||||||
alias const(void)* CGContextRef;
|
alias const(void)* CGContextRef;
|
||||||
alias const(void)* CGColorSpaceRef;
|
alias const(void)* CGColorSpaceRef;
|
||||||
alias const(void)* CGImageRef;
|
alias const(void)* CGImageRef;
|
||||||
alias uint CGBitmapInfo;
|
alias ulong CGBitmapInfo;
|
||||||
|
|
||||||
struct objc_super {
|
struct objc_super {
|
||||||
id self;
|
id self;
|
||||||
|
@ -12264,18 +12268,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CFRange {
|
struct CFRange {
|
||||||
int location, length;
|
long location, length;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NSPoint {
|
struct NSPoint {
|
||||||
float x, y;
|
double x, y;
|
||||||
|
|
||||||
static fromTuple(T)(T tupl) {
|
static fromTuple(T)(T tupl) {
|
||||||
return NSPoint(tupl.tupleof);
|
return NSPoint(tupl.tupleof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct NSSize {
|
struct NSSize {
|
||||||
float width, height;
|
double width, height;
|
||||||
}
|
}
|
||||||
struct NSRect {
|
struct NSRect {
|
||||||
NSPoint origin;
|
NSPoint origin;
|
||||||
|
@ -12286,7 +12290,7 @@ private:
|
||||||
alias NSRect CGRect;
|
alias NSRect CGRect;
|
||||||
|
|
||||||
struct CGAffineTransform {
|
struct CGAffineTransform {
|
||||||
float a, b, c, d, tx, ty;
|
double a, b, c, d, tx, ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum NSApplicationActivationPolicyRegular = 0;
|
enum NSApplicationActivationPolicyRegular = 0;
|
||||||
|
@ -12302,7 +12306,7 @@ private:
|
||||||
NSTexturedBackgroundWindowMask = 1 << 8
|
NSTexturedBackgroundWindowMask = 1 << 8
|
||||||
}
|
}
|
||||||
|
|
||||||
enum : uint {
|
enum : ulong {
|
||||||
kCGImageAlphaNone,
|
kCGImageAlphaNone,
|
||||||
kCGImageAlphaPremultipliedLast,
|
kCGImageAlphaPremultipliedLast,
|
||||||
kCGImageAlphaPremultipliedFirst,
|
kCGImageAlphaPremultipliedFirst,
|
||||||
|
@ -12311,7 +12315,7 @@ private:
|
||||||
kCGImageAlphaNoneSkipLast,
|
kCGImageAlphaNoneSkipLast,
|
||||||
kCGImageAlphaNoneSkipFirst
|
kCGImageAlphaNoneSkipFirst
|
||||||
}
|
}
|
||||||
enum : uint {
|
enum : ulong {
|
||||||
kCGBitmapAlphaInfoMask = 0x1F,
|
kCGBitmapAlphaInfoMask = 0x1F,
|
||||||
kCGBitmapFloatComponents = (1 << 8),
|
kCGBitmapFloatComponents = (1 << 8),
|
||||||
kCGBitmapByteOrderMask = 0x7000,
|
kCGBitmapByteOrderMask = 0x7000,
|
||||||
|
@ -12360,12 +12364,12 @@ private:
|
||||||
|
|
||||||
CFStringRef CFStringCreateWithBytes(CFAllocatorRef allocator,
|
CFStringRef CFStringCreateWithBytes(CFAllocatorRef allocator,
|
||||||
const(char)* bytes, long numBytes,
|
const(char)* bytes, long numBytes,
|
||||||
int encoding,
|
long encoding,
|
||||||
BOOL isExternalRepresentation);
|
BOOL isExternalRepresentation);
|
||||||
int CFStringGetBytes(CFStringRef theString, CFRange range, int encoding,
|
long CFStringGetBytes(CFStringRef theString, CFRange range, long encoding,
|
||||||
char lossByte, bool isExternalRepresentation,
|
char lossByte, bool isExternalRepresentation,
|
||||||
char* buffer, long maxBufLen, long* usedBufLen);
|
char* buffer, long maxBufLen, long* usedBufLen);
|
||||||
int CFStringGetLength(CFStringRef theString);
|
long CFStringGetLength(CFStringRef theString);
|
||||||
|
|
||||||
CGContextRef CGBitmapContextCreate(void* data,
|
CGContextRef CGBitmapContextCreate(void* data,
|
||||||
size_t width, size_t height,
|
size_t width, size_t height,
|
||||||
|
@ -12383,13 +12387,13 @@ private:
|
||||||
void CGColorSpaceRelease(CGColorSpaceRef cs);
|
void CGColorSpaceRelease(CGColorSpaceRef cs);
|
||||||
|
|
||||||
void CGContextSetRGBStrokeColor(CGContextRef c,
|
void CGContextSetRGBStrokeColor(CGContextRef c,
|
||||||
float red, float green, float blue,
|
double red, double green, double blue,
|
||||||
float alpha);
|
double alpha);
|
||||||
void CGContextSetRGBFillColor(CGContextRef c,
|
void CGContextSetRGBFillColor(CGContextRef c,
|
||||||
float red, float green, float blue,
|
double red, double green, double blue,
|
||||||
float alpha);
|
double alpha);
|
||||||
void CGContextDrawImage(CGContextRef c, CGRect rect, CGImageRef image);
|
void CGContextDrawImage(CGContextRef c, CGRect rect, CGImageRef image);
|
||||||
void CGContextShowTextAtPoint(CGContextRef c, float x, float y,
|
void CGContextShowTextAtPoint(CGContextRef c, double x, double y,
|
||||||
const(char)* str, size_t length);
|
const(char)* str, size_t length);
|
||||||
void CGContextStrokeLineSegments(CGContextRef c,
|
void CGContextStrokeLineSegments(CGContextRef c,
|
||||||
const(CGPoint)* points, size_t count);
|
const(CGPoint)* points, size_t count);
|
||||||
|
@ -12397,15 +12401,15 @@ private:
|
||||||
void CGContextBeginPath(CGContextRef c);
|
void CGContextBeginPath(CGContextRef c);
|
||||||
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode);
|
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode);
|
||||||
void CGContextAddEllipseInRect(CGContextRef c, CGRect rect);
|
void CGContextAddEllipseInRect(CGContextRef c, CGRect rect);
|
||||||
void CGContextAddArc(CGContextRef c, float x, float y, float radius,
|
void CGContextAddArc(CGContextRef c, double x, double y, double radius,
|
||||||
float startAngle, float endAngle, int clockwise);
|
double startAngle, double endAngle, long clockwise);
|
||||||
void CGContextAddRect(CGContextRef c, CGRect rect);
|
void CGContextAddRect(CGContextRef c, CGRect rect);
|
||||||
void CGContextAddLines(CGContextRef c,
|
void CGContextAddLines(CGContextRef c,
|
||||||
const(CGPoint)* points, size_t count);
|
const(CGPoint)* points, size_t count);
|
||||||
void CGContextSaveGState(CGContextRef c);
|
void CGContextSaveGState(CGContextRef c);
|
||||||
void CGContextRestoreGState(CGContextRef c);
|
void CGContextRestoreGState(CGContextRef c);
|
||||||
void CGContextSelectFont(CGContextRef c, const(char)* name, float size,
|
void CGContextSelectFont(CGContextRef c, const(char)* name, double size,
|
||||||
uint textEncoding);
|
ulong textEncoding);
|
||||||
CGAffineTransform CGContextGetTextMatrix(CGContextRef c);
|
CGAffineTransform CGContextGetTextMatrix(CGContextRef c);
|
||||||
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t);
|
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t);
|
||||||
|
|
||||||
|
@ -12415,7 +12419,7 @@ private:
|
||||||
private:
|
private:
|
||||||
// A convenient method to create a CFString (=NSString) from a D string.
|
// A convenient method to create a CFString (=NSString) from a D string.
|
||||||
CFStringRef createCFString(string str) {
|
CFStringRef createCFString(string str) {
|
||||||
return CFStringCreateWithBytes(null, str.ptr, cast(int) str.length,
|
return CFStringCreateWithBytes(null, str.ptr, cast(long) str.length,
|
||||||
kCFStringEncodingUTF8, false);
|
kCFStringEncodingUTF8, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12502,7 +12506,7 @@ version(OSXCocoa) {
|
||||||
|
|
||||||
// if rawData had a length....
|
// if rawData had a length....
|
||||||
//assert(rawData.length == where.length);
|
//assert(rawData.length == where.length);
|
||||||
for(int idx = 0; idx < where.length; idx += 4) {
|
for(long idx = 0; idx < where.length; idx += 4) {
|
||||||
auto alpha = rawData[idx + 3];
|
auto alpha = rawData[idx + 3];
|
||||||
if(alpha == 255) {
|
if(alpha == 255) {
|
||||||
where[idx + 0] = rawData[idx + 0]; // r
|
where[idx + 0] = rawData[idx + 0]; // r
|
||||||
|
@ -12525,7 +12529,7 @@ version(OSXCocoa) {
|
||||||
|
|
||||||
// if rawData had a length....
|
// if rawData had a length....
|
||||||
//assert(rawData.length == where.length);
|
//assert(rawData.length == where.length);
|
||||||
for(int idx = 0; idx < where.length; idx += 4) {
|
for(long idx = 0; idx < where.length; idx += 4) {
|
||||||
auto alpha = rawData[idx + 3];
|
auto alpha = rawData[idx + 3];
|
||||||
if(alpha == 255) {
|
if(alpha == 255) {
|
||||||
rawData[idx + 0] = where[idx + 0]; // r
|
rawData[idx + 0] = where[idx + 0]; // r
|
||||||
|
@ -12597,7 +12601,7 @@ version(OSXCocoa) {
|
||||||
// end
|
// end
|
||||||
|
|
||||||
@property void outlineColor(Color color) {
|
@property void outlineColor(Color color) {
|
||||||
float alphaComponent = color.a/255.0f;
|
double alphaComponent = color.a/255.0f;
|
||||||
CGContextSetRGBStrokeColor(context,
|
CGContextSetRGBStrokeColor(context,
|
||||||
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue