home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "BitBlt Games"
- ClientHeight = 6660
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 5490
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 7065
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 6660
- ScaleWidth = 5490
- Top = 1140
- Width = 5610
- Begin VB.TextBox txtUserDef
- Appearance = 0 'Flat
- Height = 315
- Left = 2940
- TabIndex = 21
- Top = 5640
- Width = 2055
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "WHITENESS"
- ForeColor = &H80000008&
- Height = 315
- Index = 14
- Left = 1980
- TabIndex = 20
- Top = 5220
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "BLACKNESS"
- ForeColor = &H80000008&
- Height = 315
- Index = 13
- Left = 1980
- TabIndex = 19
- Top = 4860
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "DSTINVERT"
- ForeColor = &H80000008&
- Height = 315
- Index = 12
- Left = 1980
- TabIndex = 18
- Top = 4500
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "PATINVERT"
- ForeColor = &H80000008&
- Height = 315
- Index = 11
- Left = 1980
- TabIndex = 17
- Top = 4140
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "PATPAINT"
- ForeColor = &H80000008&
- Height = 315
- Index = 10
- Left = 1980
- TabIndex = 16
- Top = 3780
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "PATCOPY"
- ForeColor = &H80000008&
- Height = 315
- Index = 9
- Left = 1980
- TabIndex = 15
- Top = 3420
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "MERGEPAINT"
- ForeColor = &H80000008&
- Height = 315
- Index = 8
- Left = 1980
- TabIndex = 14
- Top = 3060
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "MERGECOPY"
- ForeColor = &H80000008&
- Height = 315
- Index = 7
- Left = 1980
- TabIndex = 13
- Top = 2700
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "NOTSRCERASE"
- ForeColor = &H80000008&
- Height = 315
- Index = 6
- Left = 1980
- TabIndex = 12
- Top = 2340
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "NOTSRCCOPY"
- ForeColor = &H80000008&
- Height = 315
- Index = 5
- Left = 1980
- TabIndex = 11
- Top = 1980
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "SRCERASE"
- ForeColor = &H80000008&
- Height = 315
- Index = 4
- Left = 1980
- TabIndex = 10
- Top = 1620
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "SRCINVERT"
- ForeColor = &H80000008&
- Height = 315
- Index = 3
- Left = 1980
- TabIndex = 9
- Top = 1260
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "SRCAND"
- ForeColor = &H80000008&
- Height = 315
- Index = 2
- Left = 1980
- TabIndex = 8
- Top = 900
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "SRCPAINT"
- ForeColor = &H80000008&
- Height = 315
- Index = 1
- Left = 1980
- TabIndex = 7
- Top = 540
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "SRCCOPY"
- ForeColor = &H80000008&
- Height = 315
- Index = 0
- Left = 1980
- TabIndex = 6
- Top = 180
- Value = -1 'True
- Width = 1815
- End
- Begin VB.CommandButton cmdPatBlt
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "PatBlt"
- Height = 435
- Left = 2640
- TabIndex = 5
- Top = 6060
- Width = 1095
- End
- Begin VB.PictureBox picBrush
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 495
- Left = 1500
- ScaleHeight = 465
- ScaleWidth = 945
- TabIndex = 3
- Top = 6060
- Width = 975
- End
- Begin VB.CommandButton cmdBitBlt
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "BitBlt"
- Height = 435
- Left = 3960
- TabIndex = 2
- Top = 6060
- Width = 1215
- End
- Begin VB.PictureBox picDest
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 5355
- Left = 4140
- ScaleHeight = 355
- ScaleMode = 3 'Pixel
- ScaleWidth = 59
- TabIndex = 1
- Top = 180
- Width = 915
- End
- Begin VB.PictureBox picSource
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 5355
- Left = 600
- ScaleHeight = 355
- ScaleMode = 3 'Pixel
- ScaleWidth = 59
- TabIndex = 0
- Top = 180
- Width = 915
- End
- Begin VB.Label labRes
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 255
- Left = 180
- TabIndex = 23
- Top = 5640
- Width = 375
- End
- Begin VB.Label Label2
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "User Defined:"
- ForeColor = &H80000008&
- Height = 255
- Left = 960
- TabIndex = 22
- Top = 5640
- Width = 1815
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Current Brush:"
- ForeColor = &H80000008&
- Height = 315
- Left = 120
- TabIndex = 4
- Top = 6120
- Width = 1275
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- ' Globals
- Dim CellHeight& ' Height in pixels of one color cell
- Dim CurrentMouseY& ' Current Y location
- Dim CurrentBrush% ' Current brush to use
- Dim CurrentOption%
- ' API calls
- Private Declare Function DeleteObject% Lib "GDI" (ByVal hObject%)
- Private Declare Function CreateSolidBrush% Lib "GDI" (ByVal crColor&)
- Private Declare Function PatBlt% Lib "GDI" (ByVal hDC%, ByVal x%, ByVal y%, ByVal nWidth%, ByVal nHeight%, ByVal dwRop&)
- Private Declare Function BitBlt% Lib "GDI" (ByVal hDestDC%, ByVal x%, ByVal y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal dwRop&)
- Private Declare Function SelectObject% Lib "GDI" (ByVal hDC%, ByVal hObject%)
- ' The most common raster operations
- Dim RasterOps&(15)
- Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
- Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
- Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
- Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
- Const SRCERASE = &H440328 ' (DWORD) dest = source AND (NOT dest )
- Const NOTSRCCOPY = &H330008 ' (DWORD) dest = (NOT source)
- Const NOTSRCERASE = &H1100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
- Const MERGECOPY = &HC000CA ' (DWORD) dest = (source AND pattern)
- Const MERGEPAINT = &HBB0226 ' (DWORD) dest = (NOT source) OR dest
- Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
- Const PATPAINT = &HFB0A09 ' (DWORD) dest = (Not source) or pattern or dest
- Const PATINVERT = &H5A0049 ' (DWORD) dest = pattern XOR dest
- Const DSTINVERT = &H550009 ' (DWORD) dest = (NOT dest)
- Const BLACKNESS = &H42& ' (DWORD) dest = BLACK
- Const WHITENESS = &HFF0062 ' (DWORD) dest = WHITE
- Private Sub cmdBitBlt_Click()
- Dim di%
- Dim raster&
- Dim oldbrush%
- If Len(txtUserDef.Text) <> 0 Then
- raster& = "&H" & txtUserDef.Text
- Else
- raster& = RasterOps(CurrentOption%)
- End If
-
- Debug.Print raster&
- oldbrush% = SelectObject(picDest.hDC, CurrentBrush%)
- di% = BitBlt%(picDest.hDC, 0, 0, picDest.ScaleWidth, picDest.ScaleHeight, picSource.hDC, 0, 0, raster&)
- oldbrush% = SelectObject(picDest.hDC, oldbrush%)
- labRes.Caption = di%
- End Sub
- Private Sub cmdPatBlt_Click()
- Dim di%
- Dim raster&
- Dim oldbrush%
- If Len(txtUserDef.Text) <> 0 Then
- raster& = "&H" & txtUserDef.Text
- Else
- raster& = RasterOps(CurrentOption%)
- End If
-
- Debug.Print raster&
- oldbrush% = SelectObject(picDest.hDC, CurrentBrush%)
- di% = PatBlt%(picDest.hDC, 0, 0, picDest.ScaleWidth, picDest.ScaleHeight, raster&)
- oldbrush% = SelectObject(picDest.hDC, oldbrush%)
- labRes.Caption = di%
- End Sub
- Private Sub Form_Load()
- ' Default to a white brush
- CurrentBrush% = CreateSolidBrush(QBColor(15))
- RasterOps(0) = SRCCOPY
- RasterOps(1) = SRCPAINT
- RasterOps(2) = SRCAND
- RasterOps(3) = SRCINVERT
- RasterOps(4) = SRCERASE
- RasterOps(5) = NOTSRCCOPY
- RasterOps(6) = NOTSRCERASE
- RasterOps(7) = MERGECOPY
- RasterOps(8) = MERGEPAINT
- RasterOps(9) = PATCOPY
- RasterOps(10) = PATPAINT
- RasterOps(11) = PATINVERT
- RasterOps(12) = DSTINVERT
- RasterOps(13) = BLACKNESS
- RasterOps(14) = WHITENESS
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Dim di%
- If CurrentBrush% Then di% = DeleteObject(CurrentBrush%)
- End Sub
- Private Sub Option1_Click(Index As Integer)
- CurrentOption% = Index
- End Sub
- Private Sub picSource_Click()
- Dim usecolor%, di%
- If CurrentBrush% Then di% = DeleteObject(CurrentBrush%)
- usecolor% = CInt(CurrentMouseY \ CellHeight)
- If usecolor% < 0 Then usecolor% = 0
- If usecolor% > 15 Then usecolor% = 15
- CurrentBrush% = CreateSolidBrush(QBColor(usecolor%))
- picBrush.BackColor = QBColor(usecolor%)
- End Sub
- Private Sub picSource_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
- CurrentMouseY = y
- End Sub
- Private Sub picSource_Paint()
- Dim x%
- ' Determine the height of each block of color
- CellHeight& = picSource.ScaleHeight \ 16
- For x% = 0 To 15
- picSource.Line (0, CellHeight * x)-(picSource.ScaleWidth, CellHeight * (x + 1)), QBColor(x%), BF
- Next x%
- End Sub
- Private Sub txtUserDef_Change()
- Dim txtEmpty%
- Dim x%
- txtEmpty% = Len(txtUserDef.Text) = 0
- ' Set option button enabled status
- For x% = 0 To 14
- Option1(x%).Enabled = txtEmpty%
- Next x%
- End Sub
-