Mercurial > projects > dwt-mac
comparison dwt/graphics/GC.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 1a8b3cb347e0 |
children | a9ab4c738ed8 |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
329 size = data.transform.transformSize(size); | 329 size = data.transform.transformSize(size); |
330 } | 330 } |
331 float scaling = size.width; | 331 float scaling = size.width; |
332 if (scaling < 0) scaling = -scaling; | 332 if (scaling < 0) scaling = -scaling; |
333 float strokeWidth = data.lineWidth * scaling; | 333 float strokeWidth = data.lineWidth * scaling; |
334 if (strokeWidth is 0 || ((int)strokeWidth % 2) is 1) { | 334 if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { |
335 data.drawXOffset = 0.5f / scaling; | 335 data.drawXOffset = 0.5f / scaling; |
336 } | 336 } |
337 scaling = size.height; | 337 scaling = size.height; |
338 if (scaling < 0) scaling = -scaling; | 338 if (scaling < 0) scaling = -scaling; |
339 strokeWidth = data.lineWidth * scaling; | 339 strokeWidth = data.lineWidth * scaling; |
340 if (strokeWidth is 0 || ((int)strokeWidth % 2) is 1) { | 340 if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { |
341 data.drawYOffset = 0.5f / scaling; | 341 data.drawYOffset = 0.5f / scaling; |
342 } | 342 } |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
373 // Rect srcRect = new Rect (); | 373 // Rect srcRect = new Rect (); |
374 // CGPoint pt = new CGPoint (); | 374 // CGPoint pt = new CGPoint (); |
375 // int[] contentView = new int[1]; | 375 // int[] contentView = new int[1]; |
376 // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); | 376 // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); |
377 // OS.HIViewConvertPoint (pt, data.control, contentView[0]); | 377 // OS.HIViewConvertPoint (pt, data.control, contentView[0]); |
378 // x += (int) pt.x; | 378 // x += cast(int) pt.x; |
379 // y += (int) pt.y; | 379 // y += cast(int) pt.y; |
380 // Rect inset = data.insetRect; | 380 // Rect inset = data.insetRect; |
381 // x -= inset.left; | 381 // x -= inset.left; |
382 // y -= inset.top; | 382 // y -= inset.top; |
383 // srcRect.left = (short)x; | 383 // srcRect.left = cast(short)x; |
384 // srcRect.top = (short)y; | 384 // srcRect.top = cast(short)y; |
385 // srcRect.right = (short)(x + width); | 385 // srcRect.right = cast(short)(x + width); |
386 // srcRect.bottom = (short)(y + height); | 386 // srcRect.bottom = cast(short)(y + height); |
387 // Rect destRect = new Rect(); | 387 // Rect destRect = new Rect(); |
388 // destRect.right = (short)width; | 388 // destRect.right = cast(short)width; |
389 // destRect.bottom = (short)height; | 389 // destRect.bottom = cast(short)height; |
390 // int bpl = width * 4; | 390 // int bpl = width * 4; |
391 // int[] gWorld = new int[1]; | 391 // int[] gWorld = new int[1]; |
392 // int port = OS.GetWindowPort(window); | 392 // int port = OS.GetWindowPort(window); |
393 // OS.NewGWorldFromPtr(gWorld, OS.k32ARGBPixelFormat, destRect, 0, 0, 0, image.data, bpl); | 393 // OS.NewGWorldFromPtr(gWorld, OS.k32ARGBPixelFormat, destRect, 0, 0, 0, image.data, bpl); |
394 // OS.CopyBits(OS.GetPortBitMapForCopyBits(port), OS.GetPortBitMapForCopyBits(gWorld[0]), srcRect, destRect, (short)OS.srcCopy, 0); | 394 // OS.CopyBits(OS.GetPortBitMapForCopyBits(port), OS.GetPortBitMapForCopyBits(gWorld[0]), srcRect, destRect, cast(short)OS.srcCopy, 0); |
395 // OS.DisposeGWorld(gWorld [0]); | 395 // OS.DisposeGWorld(gWorld [0]); |
396 // } else if (data.window !is 0) { | 396 // } else if (data.window !is 0) { |
397 // int imageHandle = image.handle; | 397 // int imageHandle = image.handle; |
398 // CGRect rect = new CGRect(); | 398 // CGRect rect = new CGRect(); |
399 // rect.x = x; | 399 // rect.x = x; |
530 // int convertX = 0, convertY = 0; | 530 // int convertX = 0, convertY = 0; |
531 // CGPoint pt = new CGPoint (); | 531 // CGPoint pt = new CGPoint (); |
532 // int[] contentView = new int[1]; | 532 // int[] contentView = new int[1]; |
533 // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); | 533 // OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); |
534 // OS.HIViewConvertPoint(pt, OS.HIViewGetSuperview(data.control), contentView[0]); | 534 // OS.HIViewConvertPoint(pt, OS.HIViewGetSuperview(data.control), contentView[0]); |
535 // convertX = rect.left + (int) pt.x; | 535 // convertX = rect.left + cast(int) pt.x; |
536 // convertY = rect.top + (int) pt.y; | 536 // convertY = rect.top + cast(int) pt.y; |
537 // rect.left += (int) pt.x; | 537 // rect.left += cast(int) pt.x; |
538 // rect.top += (int) pt.y; | 538 // rect.top += cast(int) pt.y; |
539 // rect.right += (int) pt.x; | 539 // rect.right += cast(int) pt.x; |
540 // rect.bottom += (int) pt.y; | 540 // rect.bottom += cast(int) pt.y; |
541 // Rect srcRect = new Rect(); | 541 // Rect srcRect = new Rect(); |
542 // int left = rect.left + srcX; | 542 // int left = rect.left + srcX; |
543 // int top = rect.top + srcY; | 543 // int top = rect.top + srcY; |
544 // OS.SetRect(srcRect, (short)left, (short)top, (short)(left + width), (short)(top + height)); | 544 // OS.SetRect(srcRect, cast(short)left, cast(short)top, cast(short)(left + width), cast(short)(top + height)); |
545 // int srcRgn = OS.NewRgn(); | 545 // int srcRgn = OS.NewRgn(); |
546 // OS.RectRgn(srcRgn, srcRect); | 546 // OS.RectRgn(srcRgn, srcRect); |
547 // OS.SectRect(rect, srcRect, srcRect); | 547 // OS.SectRect(rect, srcRect, srcRect); |
548 // Rect destRect = new Rect (); | 548 // Rect destRect = new Rect (); |
549 // OS.SetRect(destRect, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom); | 549 // OS.SetRect(destRect, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom); |
550 // OS.OffsetRect(destRect, (short)deltaX, (short)deltaY); | 550 // OS.OffsetRect(destRect, cast(short)deltaX, cast(short)deltaY); |
551 // int destRgn = OS.NewRgn(); | 551 // int destRgn = OS.NewRgn(); |
552 // OS.RectRgn(destRgn, destRect); | 552 // OS.RectRgn(destRgn, destRect); |
553 // | 553 // |
554 // /* Copy bits with appropriated clipping region */ | 554 // /* Copy bits with appropriated clipping region */ |
555 // if (!OS.EmptyRect(srcRect)) { | 555 // if (!OS.EmptyRect(srcRect)) { |
577 // OS.SetPort(port); | 577 // OS.SetPort(port); |
578 // int oldClip = OS.NewRgn(); | 578 // int oldClip = OS.NewRgn(); |
579 // OS.GetClip(oldClip); | 579 // OS.GetClip(oldClip); |
580 // OS.SetClip(clipRgn); | 580 // OS.SetClip(clipRgn); |
581 // OS.UnionRect(srcRect, destRect, rect); | 581 // OS.UnionRect(srcRect, destRect, rect); |
582 // OS.ScrollRect(rect, (short)deltaX, (short)deltaY, 0); | 582 // OS.ScrollRect(rect, cast(short)deltaX, cast(short)deltaY, 0); |
583 // OS.SetClip(oldClip); | 583 // OS.SetClip(oldClip); |
584 // OS.DisposeRgn(oldClip); | 584 // OS.DisposeRgn(oldClip); |
585 // OS.SetPort(currentPort[0]); | 585 // OS.SetPort(currentPort[0]); |
586 // } else { | 586 // } else { |
587 // int portBitMap = OS.GetPortBitMapForCopyBits (port); | 587 // int portBitMap = OS.GetPortBitMapForCopyBits (port); |
588 // OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, (short)OS.srcCopy, clipRgn); | 588 // OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, cast(short)OS.srcCopy, clipRgn); |
589 // OS.QDFlushPortBuffer(port, destRgn); | 589 // OS.QDFlushPortBuffer(port, destRgn); |
590 // } | 590 // } |
591 // } | 591 // } |
592 // | 592 // |
593 // if (clipRgn !is data.visibleRgn) OS.DisposeRgn(clipRgn); | 593 // if (clipRgn !is data.visibleRgn) OS.DisposeRgn(clipRgn); |
596 // | 596 // |
597 // /* Invalidate src and obscured areas */ | 597 // /* Invalidate src and obscured areas */ |
598 // if (paint) { | 598 // if (paint) { |
599 // int invalRgn = OS.NewRgn(); | 599 // int invalRgn = OS.NewRgn(); |
600 // OS.DiffRgn(srcRgn, data.visibleRgn, invalRgn); | 600 // OS.DiffRgn(srcRgn, data.visibleRgn, invalRgn); |
601 // OS.OffsetRgn(invalRgn, (short)deltaX, (short)deltaY); | 601 // OS.OffsetRgn(invalRgn, cast(short)deltaX, cast(short)deltaY); |
602 // OS.DiffRgn(srcRgn, destRgn, srcRgn); | 602 // OS.DiffRgn(srcRgn, destRgn, srcRgn); |
603 // OS.UnionRgn(srcRgn, invalRgn, invalRgn); | 603 // OS.UnionRgn(srcRgn, invalRgn, invalRgn); |
604 // OS.SectRgn(data.visibleRgn, invalRgn, invalRgn); | 604 // OS.SectRgn(data.visibleRgn, invalRgn, invalRgn); |
605 // OS.OffsetRgn(invalRgn, (short)-convertX, (short)-convertY); | 605 // OS.OffsetRgn(invalRgn, cast(short)-convertX, cast(short)-convertY); |
606 // OS.HIViewSetNeedsDisplayInRegion(data.control, invalRgn, true); | 606 // OS.HIViewSetNeedsDisplayInRegion(data.control, invalRgn, true); |
607 // OS.DisposeRgn(invalRgn); | 607 // OS.DisposeRgn(invalRgn); |
608 // } | 608 // } |
609 // | 609 // |
610 // /* Dispose src and dest regions */ | 610 // /* Dispose src and dest regions */ |
661 // } | 661 // } |
662 // } | 662 // } |
663 // length = j; | 663 // length = j; |
664 // } | 664 // } |
665 NSString str = NSString.stringWithCharacters(chars, length); | 665 NSString str = NSString.stringWithCharacters(chars, length); |
666 return ((NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); | 666 return (cast(NSAttributedString)new NSAttributedString().alloc()).initWithString_attributes_(str, dict); |
667 } | 667 } |
668 | 668 |
669 void destroy() { | 669 void destroy() { |
670 /* Free resources */ | 670 /* Free resources */ |
671 Image image = data.image; | 671 Image image = data.image; |
857 NSGraphicsContext context = NSGraphicsContext.currentContext(); | 857 NSGraphicsContext context = NSGraphicsContext.currentContext(); |
858 NSGraphicsContext.setCurrentContext(handle); | 858 NSGraphicsContext.setCurrentContext(handle); |
859 checkGC(CLIPPING | TRANSFORM); | 859 checkGC(CLIPPING | TRANSFORM); |
860 NSImage imageHandle = srcImage.handle; | 860 NSImage imageHandle = srcImage.handle; |
861 NSSize size = imageHandle.size(); | 861 NSSize size = imageHandle.size(); |
862 int imgWidth = (int)size.width; | 862 int imgWidth = cast(int)size.width; |
863 int imgHeight = (int)size.height; | 863 int imgHeight = cast(int)size.height; |
864 if (simple) { | 864 if (simple) { |
865 srcWidth = destWidth = imgWidth; | 865 srcWidth = destWidth = imgWidth; |
866 srcHeight = destHeight = imgHeight; | 866 srcHeight = destHeight = imgHeight; |
867 } else { | 867 } else { |
868 simple = srcX is 0 && srcY is 0 && | 868 simple = srcX is 0 && srcY is 0 && |
1399 * @see #hashCode | 1399 * @see #hashCode |
1400 */ | 1400 */ |
1401 public bool equals(Object object) { | 1401 public bool equals(Object object) { |
1402 if (object is this) return true; | 1402 if (object is this) return true; |
1403 if (!(object instanceof GC)) return false; | 1403 if (!(object instanceof GC)) return false; |
1404 return handle is ((GC)object).handle; | 1404 return handle is (cast(GC)object).handle; |
1405 } | 1405 } |
1406 | 1406 |
1407 /** | 1407 /** |
1408 * Fills the interior of a circular or elliptical arc within | 1408 * Fills the interior of a circular or elliptical arc within |
1409 * the specified rectangular area, with the receiver's background | 1409 * the specified rectangular area, with the receiver's background |
1519 if (fromRGB.equals(toRGB)) { | 1519 if (fromRGB.equals(toRGB)) { |
1520 fillRectangle(x, y, width, height); | 1520 fillRectangle(x, y, width, height); |
1521 } else { | 1521 } else { |
1522 NSColor startingColor = NSColor.colorWithDeviceRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); | 1522 NSColor startingColor = NSColor.colorWithDeviceRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); |
1523 NSColor endingColor = NSColor.colorWithDeviceRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); | 1523 NSColor endingColor = NSColor.colorWithDeviceRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); |
1524 NSGradient gradient = ((NSGradient)new NSGradient().alloc()).initWithStartingColor(startingColor, endingColor); | 1524 NSGradient gradient = (cast(NSGradient)new NSGradient().alloc()).initWithStartingColor(startingColor, endingColor); |
1525 NSRect rect = new NSRect(); | 1525 NSRect rect = new NSRect(); |
1526 rect.x = x; | 1526 rect.x = x; |
1527 rect.y = y; | 1527 rect.y = y; |
1528 rect.width = width; | 1528 rect.width = width; |
1529 rect.height = height; | 1529 rect.height = height; |
1981 rect.y = pt.y; | 1981 rect.y = pt.y; |
1982 rect.width = size.width; | 1982 rect.width = size.width; |
1983 rect.height = size.height; | 1983 rect.height = size.height; |
1984 } | 1984 } |
1985 } | 1985 } |
1986 return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); | 1986 return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); |
1987 } | 1987 } |
1988 | 1988 |
1989 /** | 1989 /** |
1990 * Sets the region managed by the argument to the current | 1990 * Sets the region managed by the argument to the current |
1991 * clipping region of the receiver. | 1991 * clipping region of the receiver. |
2017 } else if (data.size !is null) { | 2017 } else if (data.size !is null) { |
2018 rect.width = data.size.width; | 2018 rect.width = data.size.width; |
2019 rect.height = data.size.height; | 2019 rect.height = data.size.height; |
2020 } | 2020 } |
2021 } | 2021 } |
2022 region.add((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); | 2022 region.add(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); |
2023 NSRect paintRect = data.paintRect; | 2023 NSRect paintRect = data.paintRect; |
2024 if (paintRect !is null) { | 2024 if (paintRect !is null) { |
2025 region.intersect((int)paintRect.x, (int)paintRect.y, (int)paintRect.width, (int)paintRect.height); | 2025 region.intersect(cast(int)paintRect.x, cast(int)paintRect.y, cast(int)paintRect.width, cast(int)paintRect.height); |
2026 } | 2026 } |
2027 if (data.clipPath !is null) { | 2027 if (data.clipPath !is null) { |
2028 NSBezierPath clip = data.clipPath.bezierPathByFlatteningPath(); | 2028 NSBezierPath clip = data.clipPath.bezierPathByFlatteningPath(); |
2029 int count = clip.elementCount(); | 2029 int count = clip.elementCount(); |
2030 int pointCount = 0; | 2030 int pointCount = 0; |
2038 switch (element) { | 2038 switch (element) { |
2039 case OS.NSMoveToBezierPathElement: | 2039 case OS.NSMoveToBezierPathElement: |
2040 if (pointCount !is 0) clipRgn.add(pointArray, pointCount); | 2040 if (pointCount !is 0) clipRgn.add(pointArray, pointCount); |
2041 pointCount = 0; | 2041 pointCount = 0; |
2042 OS.memmove(pt, points, NSPoint.sizeof); | 2042 OS.memmove(pt, points, NSPoint.sizeof); |
2043 pointArray[pointCount++] = (int)pt.x; | 2043 pointArray[pointCount++] = cast(int)pt.x; |
2044 pointArray[pointCount++] = (int)pt.y; | 2044 pointArray[pointCount++] = cast(int)pt.y; |
2045 break; | 2045 break; |
2046 case OS.NSLineToBezierPathElement: | 2046 case OS.NSLineToBezierPathElement: |
2047 OS.memmove(pt, points, NSPoint.sizeof); | 2047 OS.memmove(pt, points, NSPoint.sizeof); |
2048 pointArray[pointCount++] = (int)pt.x; | 2048 pointArray[pointCount++] = cast(int)pt.x; |
2049 pointArray[pointCount++] = (int)pt.y; | 2049 pointArray[pointCount++] = cast(int)pt.y; |
2050 break; | 2050 break; |
2051 case OS.NSClosePathBezierPathElement: | 2051 case OS.NSClosePathBezierPathElement: |
2052 if (pointCount !is 0) clipRgn.add(pointArray, pointCount); | 2052 if (pointCount !is 0) clipRgn.add(pointArray, pointCount); |
2053 pointCount = 0; | 2053 pointCount = 0; |
2054 break; | 2054 break; |
2109 */ | 2109 */ |
2110 public FontMetrics getFontMetrics() { | 2110 public FontMetrics getFontMetrics() { |
2111 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 2111 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
2112 checkGC(FONT); | 2112 checkGC(FONT); |
2113 NSFont font = data.font.handle; | 2113 NSFont font = data.font.handle; |
2114 int ascent = (int)(0.5f + font.ascender()); | 2114 int ascent = cast(int)(0.5f + font.ascender()); |
2115 int descent = (int)(0.5f + (-font.descender() + font.leading())); | 2115 int descent = cast(int)(0.5f + (-font.descender() + font.leading())); |
2116 String s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | 2116 String s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
2117 int averageCharWidth = stringExtent(s).x / s.length(); | 2117 int averageCharWidth = stringExtent(s).x / s.length(); |
2118 return FontMetrics.cocoa_new(ascent, descent, averageCharWidth, 0, ascent + descent); | 2118 return FontMetrics.cocoa_new(ascent, descent, averageCharWidth, 0, ascent + descent); |
2119 } | 2119 } |
2120 | 2120 |
2255 public int[] getLineDash() { | 2255 public int[] getLineDash() { |
2256 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 2256 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
2257 if (data.lineDashes is null) return null; | 2257 if (data.lineDashes is null) return null; |
2258 int[] lineDashes = new int[data.lineDashes.length]; | 2258 int[] lineDashes = new int[data.lineDashes.length]; |
2259 for (int i = 0; i < lineDashes.length; i++) { | 2259 for (int i = 0; i < lineDashes.length; i++) { |
2260 lineDashes[i] = (int)data.lineDashes[i]; | 2260 lineDashes[i] = cast(int)data.lineDashes[i]; |
2261 } | 2261 } |
2262 return lineDashes; | 2262 return lineDashes; |
2263 } | 2263 } |
2264 | 2264 |
2265 /** | 2265 /** |
2309 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> | 2309 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> |
2310 * </ul> | 2310 * </ul> |
2311 */ | 2311 */ |
2312 public int getLineWidth() { | 2312 public int getLineWidth() { |
2313 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 2313 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
2314 return (int)data.lineWidth; | 2314 return cast(int)data.lineWidth; |
2315 } | 2315 } |
2316 | 2316 |
2317 /** | 2317 /** |
2318 * Returns the receiver's style information. | 2318 * Returns the receiver's style information. |
2319 * <p> | 2319 * <p> |
2528 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 2528 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
2529 if (!advanced) { | 2529 if (!advanced) { |
2530 setAlpha(0xFF); | 2530 setAlpha(0xFF); |
2531 setAntialias(DWT.DEFAULT); | 2531 setAntialias(DWT.DEFAULT); |
2532 setBackgroundPattern(null); | 2532 setBackgroundPattern(null); |
2533 setClipping((Rectangle)null); | 2533 setClipping(cast(Rectangle)null); |
2534 setForegroundPattern(null); | 2534 setForegroundPattern(null); |
2535 setInterpolation(DWT.DEFAULT); | 2535 setInterpolation(DWT.DEFAULT); |
2536 setTextAntialias(DWT.DEFAULT); | 2536 setTextAntialias(DWT.DEFAULT); |
2537 setTransform(null); | 2537 setTransform(null); |
2538 } | 2538 } |
2746 * </ul> | 2746 * </ul> |
2747 */ | 2747 */ |
2748 public void setClipping(Rectangle rect) { | 2748 public void setClipping(Rectangle rect) { |
2749 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 2749 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
2750 if (rect is null) { | 2750 if (rect is null) { |
2751 setClipping((NSBezierPath)null); | 2751 setClipping(cast(NSBezierPath)null); |
2752 } else { | 2752 } else { |
2753 setClipping(rect.x, rect.y, rect.width, rect.height); | 2753 setClipping(rect.x, rect.y, rect.width, rect.height); |
2754 } | 2754 } |
2755 } | 2755 } |
2756 | 2756 |
3310 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 3310 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
3311 if (transform !is null && transform.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); | 3311 if (transform !is null && transform.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); |
3312 if (transform !is null) { | 3312 if (transform !is null) { |
3313 if (data.transform !is null) data.transform.release(); | 3313 if (data.transform !is null) data.transform.release(); |
3314 if (data.inverseTransform !is null) data.inverseTransform.release(); | 3314 if (data.inverseTransform !is null) data.inverseTransform.release(); |
3315 data.transform = ((NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); | 3315 data.transform = (cast(NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); |
3316 data.inverseTransform = ((NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); | 3316 data.inverseTransform = (cast(NSAffineTransform)new NSAffineTransform().alloc()).initWithTransform(transform.handle); |
3317 NSAffineTransformStruct struct = data.inverseTransform.transformStruct(); | 3317 NSAffineTransformStruct struct = data.inverseTransform.transformStruct(); |
3318 if ((struct.m11 * struct.m22 - struct.m12 * struct.m21) !is 0) { | 3318 if ((struct.m11 * struct.m22 - struct.m12 * struct.m21) !is 0) { |
3319 data.inverseTransform.invert(); | 3319 data.inverseTransform.invert(); |
3320 } | 3320 } |
3321 } else { | 3321 } else { |
3405 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 3405 if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
3406 if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 3406 if (string is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
3407 checkGC(FONT); | 3407 checkGC(FONT); |
3408 NSAttributedString str = createString(string, flags); | 3408 NSAttributedString str = createString(string, flags); |
3409 NSSize size = str.size(); | 3409 NSSize size = str.size(); |
3410 return new Point((int)size.width, (int)size.height); | 3410 return new Point(cast(int)size.width, cast(int)size.height); |
3411 } | 3411 } |
3412 | 3412 |
3413 /** | 3413 /** |
3414 * Returns a string containing a concise, human-readable | 3414 * Returns a string containing a concise, human-readable |
3415 * description of the receiver. | 3415 * description of the receiver. |