Ignore:
Timestamp:
Apr 2, 2009, 5:27:22 PM (15 years ago)
Author:
イグトランス (egtra)
Message:

BrushとStringFormatを追加
(#241)

Location:
trunk/ab5.0/ablib/src/Classes/System/Drawing
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/Font.ab

    r698 r701  
    283283        nativeFont = 0
    284284        Dim family = Nothing As FontFamily
    285         Dim nativeFamily = family.NativeFamily
     285        Dim nativeFamily As *GpFontFamily
    286286
    287287        Try
    288288            family = New FontFamily(familyName, fontCollection)
     289            nativeFamily = family.NativeFamily
    289290        Catch e As Exception
    290291            nativeFamily = FontFamily.GenericSansSerif().NativeFamily
     
    292293
    293294        Try
    294             SetStatus(GdipCreateFont(nativeFamily, emSize, style, unit, nativeFont))
     295            SetStatus(GdipCreateFont(nativeFamily, emSize, style, unit As Long, nativeFont))
    295296        Catch e As Exception
    296297            nativeFamily = FontFamily.GenericSansSerif().NativeFamily
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab

    r700 r701  
    44Namespace Drawing
    55
    6 Class Brush
    7 Public
    8     nativeBrush As *GpBrush
    9 End Class
    10 Class StringFormat
    11 Public
    12     nativeFormat As *GpStringFormat
    13 End Class
    14 Class Image
    15 Public
    16     nativeImage As *GpImage
    17 End Class
    186Class ImageAttributes
    197Public
     
    2917Class GraphicsPath
    3018Public
     19    Sub GraphicsPath(native As *GpPath)
     20        nativePath = native
     21    End Sub
     22    Function NativePath() As *GpPath
     23    End Function
    3124    nativePath As *GpPath
    3225End Class
     
    508501
    509502    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))
    511504    End Sub
    512505
    513506    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))
    515508    End Sub
    516509
     
    520513
    521514    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))
    523516    End Sub
    524517
    525518    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))
    527520    End Sub
    528521
     
    532525
    533526    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))
    535528    End Sub
    536529
     
    540533
    541534    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))
    543536    End Sub
    544537
     
    548541
    549542    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))
    551544    End Sub
    552545
     
    556549
    557550    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))
    559552    End Sub
    560553
     
    564557
    565558    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))
    567560    End Sub
    568561
     
    572565
    573566    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))
    575568    End Sub
    576569
     
    579572            Throw New ArgumentNullException("brush or path or both")
    580573        End If
    581         SetStatus(GdipFillPath(nativeGraphics, brush.nativeBrush, path.nativePath))
     574        SetStatus(GdipFillPath(nativeGraphics, brush.NativeBrush, path.nativePath))
    582575    End Sub
    583576
    584577    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))
    586579    End Sub
    587580
    588581    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))
    590583    End Sub
    591584
    592585    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))
    594587    End Sub
    595588
    596589    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))
    598591    End Sub
    599592
    600593    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))
    602595    End Sub
    603596
    604597    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))
    606599    End Sub
    607600
    608601    Sub FillRegion(brush As Brush, region As Region)
    609         SetStatus(GdipFillRegion(nativeGraphics, brush.nativeBrush, region.nativeRegion))
     602        SetStatus(GdipFillRegion(nativeGraphics, brush.NativeBrush, region.nativeRegion))
    610603    End Sub
    611604
     
    629622    Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat)
    630623        Dim nativeFont = getNativeFont(font)
    631         Dim nativeFormat = getNativeStringFormat(stringFormat)
     624        Dim nativeFormat = GetNativeStringFormat(stringFormat)
    632625        Dim nativeBrush = getNativeBrush(brush)
    633626        SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
     
    739732    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
    740733        Dim nativeFont = getNativeFont(font)
    741         Dim nativeFormat = getNativeStringFormat(stringFormat)
     734        Dim nativeFormat = GetNativeStringFormat(stringFormat)
    742735        Dim boundingBox As RectangleF
    743736        SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, boundingBox, codepointsFitted, linesFilled))
     
    759752        End If
    760753        Dim count As Long
    761         SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.nativeFormat, count))
     754        SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.NativeFormat, count))
    762755        Dim nativeRegions As **GpRegion 'ここで = GC_mallocとすると、エラーになる。
    763756        nativeRegions = GC_malloc(count * SizeOf(*GpRegion))
     
    771764        Next
    772765        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))
    774767    End Function
    775768
     
    12241217    End Function
    12251218
    1226     Static Function getNativeStringFormat(sf As StringFormat) As *GpStringFormat
    1227         If ActiveBasic.IsNothing(sf) Then
    1228             getNativeStringFormat = 0
    1229         Else
    1230             getNativeStringFormat = sf.nativeFormat
    1231         End If
    1232     End Function
    1233 
    12341219    Static Function getNativeBrush(br As Brush) As *GpBrush
    12351220        If ActiveBasic.IsNothing(br) Then
    12361221            getNativeBrush = 0
    12371222        Else
    1238             getNativeBrush = br.nativeBrush
     1223            getNativeBrush = br.NativeBrush
    12391224        End If
    12401225    End Function
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/Image.ab

    r635 r701  
    66Class Image
    77Public
     8    Sub Image(native As *GpImage)
     9        nativeImage = native
     10    End Sub
     11
    812    Function NativeImage() As *GpImage
    913        Return nativeImage
    1014    End Function
    11 Private
     15'Private
    1216    nativeImage As *GpImage
    1317End Class
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/Pen.ab

    r698 r701  
    2727            Throw New ArgumentNullException("brush")
    2828        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))
    3030    End Sub
    3131
     
    268268            getNativeBrush = 0
    269269        Else
    270             getNativeBrush = br.nativeBrush
     270            getNativeBrush = br.NativeBrush
    271271        End If
    272272    End Function
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/misc.ab

    r700 r701  
    2727
    2828Enum GraphicsUnit
    29     World       ' 0
    30     Display     ' 1
    31     Pixel       ' 2
    32     Point       ' 3
    33     Inch        ' 4
    34     Document    ' 5
    35     Millimeter  ' 6
     29    World = 0
     30    Display = 1
     31    Pixel = 2
     32    Point = 3
     33    Inch = 4
     34    Document = 5
     35    Millimeter = 6
    3636End Enum
    3737
Note: See TracChangeset for help on using the changeset viewer.