- Timestamp:
- Apr 2, 2009, 5:27:22 PM (16 years ago)
- Location:
- trunk/ab5.0/ablib
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/TestCase/UI_Sample/step32_AnalogWatch_Gdiplus.ab
r698 r701 13 13 #require <Classes/System/Drawing/FontFamily.ab> 14 14 #require <Classes/System/Drawing/Pen.ab> 15 #require <Classes/System/Drawing/Brush.ab> 16 #require <Classes/System/Drawing/StringFormat.ab> 17 #require <Classes/System/Drawing/Image.ab> 15 18 #require <Classes/System/Drawing/Drawing2D/misc.ab> 16 19 #require <Classes/System/Drawing/Drawing2D/Matrix.ab> … … 36 39 Imports ActiveBasic.Math 37 40 Imports System 41 Imports System.Drawing 42 Imports System.Drawing.Drawing2D 38 43 39 44 #resource "UI_Sample.rc" … … 76 81 77 82 Sub OnDestroy(sender As Object, e As EventArgs) 78 'GdiplusShutdown(gdipToken)83 GdiplusShutdown(gdipToken) 79 84 End Sub 80 85 … … 96 101 97 102 Sub OnPaint_(sender As Object, e As PaintDCArgs) 98 Imports System.Drawing99 100 103 Dim pos As PointF 101 104 … … 136 139 g.DrawLine(pen, CenterPos, pos) 137 140 pen.Dispose() 141 142 Dim pt1 = [0, 0] As Point 143 Dim pt2 As Point 144 pt2.X = rc.right 145 pt2.Y = rc.bottom 146 Dim br = New LinearGradientBrush(pt1, pt2, &haa00ff40 As Color, &h66ffcc00 As Color) 'New SolidBrush(&h8080ff00) 147 br.GammaCorrection = True 148 Dim f = New Font("Verdana", 20.0) 149 Dim s = "Step32. Analog whach" As String 150 g.RotateTransform(25) 151 g.DrawString(s, f, br, 10.0, 10.0) 152 f.Dispose() 153 br.Dispose() 154 138 155 g.Dispose() 139 156 End Sub -
trunk/ab5.0/ablib/src/Classes/System/Drawing/Font.ab
r698 r701 283 283 nativeFont = 0 284 284 Dim family = Nothing As FontFamily 285 Dim nativeFamily = family.NativeFamily285 Dim nativeFamily As *GpFontFamily 286 286 287 287 Try 288 288 family = New FontFamily(familyName, fontCollection) 289 nativeFamily = family.NativeFamily 289 290 Catch e As Exception 290 291 nativeFamily = FontFamily.GenericSansSerif().NativeFamily … … 292 293 293 294 Try 294 SetStatus(GdipCreateFont(nativeFamily, emSize, style, unit , nativeFont))295 SetStatus(GdipCreateFont(nativeFamily, emSize, style, unit As Long, nativeFont)) 295 296 Catch e As Exception 296 297 nativeFamily = FontFamily.GenericSansSerif().NativeFamily -
trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab
r700 r701 4 4 Namespace Drawing 5 5 6 Class Brush7 Public8 nativeBrush As *GpBrush9 End Class10 Class StringFormat11 Public12 nativeFormat As *GpStringFormat13 End Class14 Class Image15 Public16 nativeImage As *GpImage17 End Class18 6 Class ImageAttributes 19 7 Public … … 29 17 Class GraphicsPath 30 18 Public 19 Sub GraphicsPath(native As *GpPath) 20 nativePath = native 21 End Sub 22 Function NativePath() As *GpPath 23 End Function 31 24 nativePath As *GpPath 32 25 End Class … … 508 501 509 502 Sub FillRectangle(brush As Brush, x As Single, y As Single, width As Single, height As Single) 510 SetStatus(GdipFillRectangle(nativeGraphics, brush. nativeBrush, x, y, width, height))503 SetStatus(GdipFillRectangle(nativeGraphics, brush.NativeBrush, x, y, width, height)) 511 504 End Sub 512 505 513 506 Sub FillRectangles(brush As Brush, rects As *RectangleF, count As Long) 514 SetStatus(GdipFillRectangles(nativeGraphics,brush. nativeBrush,rects, count))507 SetStatus(GdipFillRectangles(nativeGraphics,brush.NativeBrush,rects, count)) 515 508 End Sub 516 509 … … 520 513 521 514 Sub FillRectangle(brush As Brush, x As Long, y As Long, width As Long, height As Long) 522 SetStatus(GdipFillRectangleI(nativeGraphics, brush. nativeBrush, x, y, width, height))515 SetStatus(GdipFillRectangleI(nativeGraphics, brush.NativeBrush, x, y, width, height)) 523 516 End Sub 524 517 525 518 Sub FillRectangles(brush As Brush, rects As *Rectangle, count As Long) 526 SetStatus(GdipFillRectanglesI(nativeGraphics, brush. nativeBrush, rects, count))519 SetStatus(GdipFillRectanglesI(nativeGraphics, brush.NativeBrush, rects, count)) 527 520 End Sub 528 521 … … 532 525 533 526 Sub FillPolygon(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode) 534 SetStatus(GdipFillPolygon(nativeGraphics, brush. nativeBrush, points, count, fillMode))527 SetStatus(GdipFillPolygon(nativeGraphics, brush.NativeBrush, points, count, fillMode)) 535 528 End Sub 536 529 … … 540 533 541 534 Sub FillPolygon(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode) 542 SetStatus(GdipFillPolygonI(nativeGraphics, brush. nativeBrush, points, count, fillMode))535 SetStatus(GdipFillPolygonI(nativeGraphics, brush.NativeBrush, points, count, fillMode)) 543 536 End Sub 544 537 … … 548 541 549 542 Sub FillEllipse(brush As Brush, x As Single, y As Single, width As Single, height As Single) 550 SetStatus(GdipFillEllipse(nativeGraphics, brush. nativeBrush, x, y, width, height))543 SetStatus(GdipFillEllipse(nativeGraphics, brush.NativeBrush, x, y, width, height)) 551 544 End Sub 552 545 … … 556 549 557 550 Sub FillEllipse(brush As Brush, x As Long, y As Long, width As Long, height As Long) 558 SetStatus(GdipFillEllipseI(nativeGraphics, brush. nativeBrush, x, y, width, height))551 SetStatus(GdipFillEllipseI(nativeGraphics, brush.NativeBrush, x, y, width, height)) 559 552 End Sub 560 553 … … 564 557 565 558 Sub FillPie(brush As Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) 566 SetStatus(GdipFillPie(nativeGraphics, brush. nativeBrush, x, y, width, height, startAngle, sweepAngle))559 SetStatus(GdipFillPie(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle)) 567 560 End Sub 568 561 … … 572 565 573 566 Sub FillPie(brush As Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) 574 SetStatus(GdipFillPieI(nativeGraphics, brush. nativeBrush, x, y, width, height, startAngle, sweepAngle))567 SetStatus(GdipFillPieI(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle)) 575 568 End Sub 576 569 … … 579 572 Throw New ArgumentNullException("brush or path or both") 580 573 End If 581 SetStatus(GdipFillPath(nativeGraphics, brush. nativeBrush, path.nativePath))574 SetStatus(GdipFillPath(nativeGraphics, brush.NativeBrush, path.nativePath)) 582 575 End Sub 583 576 584 577 Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long) 585 SetStatus(GdipFillClosedCurve(nativeGraphics, brush. nativeBrush, points, count))578 SetStatus(GdipFillClosedCurve(nativeGraphics, brush.NativeBrush, points, count)) 586 579 End Sub 587 580 588 581 Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode) 589 SetStatus(GdipFillClosedCurve2(nativeGraphics, brush. nativeBrush, points, count, 0.5, fillMode))582 SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode)) 590 583 End Sub 591 584 592 585 Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode, tension As Single) 593 SetStatus(GdipFillClosedCurve2(nativeGraphics, brush. nativeBrush, points, count, tension, fillMode))586 SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode)) 594 587 End Sub 595 588 596 589 Sub FillClosedCurve(brush As Brush, points As *Point, count As Long) 597 SetStatus(GdipFillClosedCurveI(nativeGraphics, brush. nativeBrush, points, count))590 SetStatus(GdipFillClosedCurveI(nativeGraphics, brush.NativeBrush, points, count)) 598 591 End Sub 599 592 600 593 Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode) 601 SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush. nativeBrush, points, count, 0.5, fillMode))594 SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode)) 602 595 End Sub 603 596 604 597 Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode, tension As Single) 605 SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush. nativeBrush, points, count, tension, fillMode))598 SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode)) 606 599 End Sub 607 600 608 601 Sub FillRegion(brush As Brush, region As Region) 609 SetStatus(GdipFillRegion(nativeGraphics, brush. nativeBrush, region.nativeRegion))602 SetStatus(GdipFillRegion(nativeGraphics, brush.NativeBrush, region.nativeRegion)) 610 603 End Sub 611 604 … … 629 622 Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat) 630 623 Dim nativeFont = getNativeFont(font) 631 Dim nativeFormat = getNativeStringFormat(stringFormat)624 Dim nativeFormat = GetNativeStringFormat(stringFormat) 632 625 Dim nativeBrush = getNativeBrush(brush) 633 626 SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush)) … … 739 732 Function measureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat, codepointsFitted As *Long, linesFilled As *Long) As SizeF 740 733 Dim nativeFont = getNativeFont(font) 741 Dim nativeFormat = getNativeStringFormat(stringFormat)734 Dim nativeFormat = GetNativeStringFormat(stringFormat) 742 735 Dim boundingBox As RectangleF 743 736 SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, boundingBox, codepointsFitted, linesFilled)) … … 759 752 End If 760 753 Dim count As Long 761 SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat. nativeFormat, count))754 SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.NativeFormat, count)) 762 755 Dim nativeRegions As **GpRegion 'ここで = GC_mallocとすると、エラーになる。 763 756 nativeRegions = GC_malloc(count * SizeOf(*GpRegion)) … … 771 764 Next 772 765 Dim nativeFont = getNativeFont(font) 773 SetStatus(GdipMeasureCharacterRanges(nativeGraphics, str, length, nativeFont, layoutRect, stringFormat. nativeFormat, count, nativeRegions))766 SetStatus(GdipMeasureCharacterRanges(nativeGraphics, str, length, nativeFont, layoutRect, stringFormat.NativeFormat, count, nativeRegions)) 774 767 End Function 775 768 … … 1224 1217 End Function 1225 1218 1226 Static Function getNativeStringFormat(sf As StringFormat) As *GpStringFormat1227 If ActiveBasic.IsNothing(sf) Then1228 getNativeStringFormat = 01229 Else1230 getNativeStringFormat = sf.nativeFormat1231 End If1232 End Function1233 1234 1219 Static Function getNativeBrush(br As Brush) As *GpBrush 1235 1220 If ActiveBasic.IsNothing(br) Then 1236 1221 getNativeBrush = 0 1237 1222 Else 1238 getNativeBrush = br. nativeBrush1223 getNativeBrush = br.NativeBrush 1239 1224 End If 1240 1225 End Function -
trunk/ab5.0/ablib/src/Classes/System/Drawing/Image.ab
r635 r701 6 6 Class Image 7 7 Public 8 Sub Image(native As *GpImage) 9 nativeImage = native 10 End Sub 11 8 12 Function NativeImage() As *GpImage 9 13 Return nativeImage 10 14 End Function 11 Private15 'Private 12 16 nativeImage As *GpImage 13 17 End Class -
trunk/ab5.0/ablib/src/Classes/System/Drawing/Pen.ab
r698 r701 27 27 Throw New ArgumentNullException("brush") 28 28 End If 29 SetStatus(GdipCreatePen2(brush. nativeBrush, width, 0 /*GraphicsUnit.World As GpUnit*/, nativePen))29 SetStatus(GdipCreatePen2(brush.NativeBrush, width, 0 /*GraphicsUnit.World As GpUnit*/, nativePen)) 30 30 End Sub 31 31 … … 268 268 getNativeBrush = 0 269 269 Else 270 getNativeBrush = br. nativeBrush270 getNativeBrush = br.NativeBrush 271 271 End If 272 272 End Function -
trunk/ab5.0/ablib/src/Classes/System/Drawing/misc.ab
r700 r701 27 27 28 28 Enum GraphicsUnit 29 World '030 Display '131 Pixel '232 Point '333 Inch '434 Document '535 Millimeter '629 World = 0 30 Display = 1 31 Pixel = 2 32 Point = 3 33 Inch = 4 34 Document = 5 35 Millimeter = 6 36 36 End Enum 37 37 -
trunk/ab5.0/ablib/src/GdiPlusFlat.ab
r700 r701 152 152 Declare Function GdipCloneBrush Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByRef cloneBrush As *GpBrush) As GpStatus 153 153 Declare Function GdipDeleteBrush Lib "gdiplus.dll" (ByVal brush As *GpBrush) As GpStatus 154 Declare Function GdipGetBrushType Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByRef brushType As *GpBrushType) As GpStatus154 Declare Function GdipGetBrushType Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByRef brushType As GpBrushType) As GpStatus 155 155 156 156 ' HatchBrush APIs … … 188 188 Declare Function GdipCreateLineBrushFromRectI Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal mode As Long /*LinearGradientMode*/, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus 189 189 Declare Function GdipCreateLineBrushFromRectWithAngle Lib "gdiplus.dll" (ByRef rect As GpRectF, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal angle As Single, ByVal isAngleScalable As BOOL, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus 190 Declare Function GdipCreateLineBrushFromRectWithAngleI Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal angle As Single, ByVal isAngleScalable As BOOL, By Ref lineGradient As *GpLineGradient) As GpStatus190 Declare Function GdipCreateLineBrushFromRectWithAngleI Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal angle As Single, ByVal isAngleScalable As BOOL, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus 191 191 Declare Function GdipSetLineColors Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal color1 As ARGB, ByVal color2 As ARGB) As GpStatus 192 192 Declare Function GdipGetLineColors Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal colors As *ARGB) As GpStatus … … 223 223 Declare Function GdipGetPathGradientPath Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal path As *GpPath) As GpStatus 224 224 Declare Function GdipSetPathGradientPath Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal path As *GpPath) As GpStatus 225 Declare Function GdipGetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, By Val points As *GpPointF) As GpStatus226 Declare Function GdipGetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, By Val points As *GpPoint) As GpStatus227 Declare Function GdipSetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, By Val points As *GpPointF) As GpStatus228 Declare Function GdipSetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, By Val points As *GpPoint) As GpStatus225 Declare Function GdipGetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef points As GpPointF) As GpStatus 226 Declare Function GdipGetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef points As GpPoint) As GpStatus 227 Declare Function GdipSetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef points As GpPointF) As GpStatus 228 Declare Function GdipSetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef points As GpPoint) As GpStatus 229 229 Declare Function GdipGetPathGradientRect Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef rect As GpRectF) As GpStatus 230 230 Declare Function GdipGetPathGradientRectI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef rect As GpRect) As GpStatus
Note:
See TracChangeset
for help on using the changeset viewer.