Changeset 25 for Include/Classes/System


Ignore:
Timestamp:
Nov 30, 2006, 12:19:01 AM (18 years ago)
Author:
イグトランス (egtra)
Message:

MakeARGBのPublic化など

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Color.ab

    r11 r25  
    1818Public
    1919    Sub Color()
    20         Argb = 0 ' Black
     20        argb = MakeARGB(255, 0, 0, 0) ' Black
     21    End Sub
     22
     23    Sub Color(ByRef c As Color)
     24        argb = c.argb
    2125    End Sub
    2226
     
    2630
    2731    Sub Color(a As Byte, r As Byte, g As Byte, b As Byte)
    28         Argb = MakeARGB(a, r, g, b)
    29     End Sub
    30 
    31     Sub Color(argb As ARGB)
    32         Argb = argb
     32        argb = MakeARGB(a, r, g, b)
     33    End Sub
     34
     35    Sub Color(newArgb As ARGB)
     36        argb = newArgb
    3337    End Sub
    3438
    3539    Sub Operator =(c As Color)
    36         SetValue(c)
     40        argb = c.argb
    3741    End Sub
    3842
     
    6165    End Function
    6266
    63     Function GetValue() As ARGB
    64         GetValue = argb
    65     End Function
    66 
    67     Sub SetValue(value As ARGB)
     67    Function Value() As ARGB
     68        Return argb
     69    End Function
     70
     71    Sub Value(value As ARGB)
    6872        argb = value
    6973    End Sub
    7074
    7175    Sub SetFromCOLORREF(rgb As COLORREF)
    72         argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb))
     76        If (rgb And &hff000000) = &h01000000 Then
     77            Exit Sub ' インデックス指定は無効
     78        Else
     79            argb = Color_MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb))
     80        End If
    7381    End Sub
    7482
     
    9199    End Function
    92100
    93     Static Function FromArgb(r As Byte, g As Byte, b As Byte)
     101    Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color
    94102        Dim c As Color(r, g, b)
    95103        Return c
    96104    End Function
    97105
    98     Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte)
     106    Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color
    99107        Dim c As Color(a, r, g, b)
    100108        Return c
     
    297305    End Enum
    298306*/
    299     ' Assemble A, R, G, B values into a 32-bit integer
    300 Private
    301     Static Function MakeARGB(/*IN*/ a As Byte,
    302                              /*IN*/ r As Byte,
    303                              /*IN*/ g As Byte,
    304                              /*IN*/ b As Byte) As ARGB
     307    Static Function MakeARGB(a As Byte, r As Byte, g As Byte, b As Byte) As ARGB
    305308        MakeARGB = (((b As ARGB) <<  Color_BlueShift) Or _
    306309                    ((g As ARGB) << Color_GreenShift) Or _
Note: See TracChangeset for help on using the changeset viewer.