滤镜.bas

来自「很好的教程原代码!」· BAS 代码 · 共 79 行

BAS
79
字号
Attribute VB_Name = "Module1"
Option Explicit
Global Custom(3, 3) As Integer
Global NeedShow As Boolean
Global Norm As Integer, Bias As Integer
Global Const freq As Double = 1193180
Global Start As Long

Type LARGE_INTEGER
    lowpart As Long
    highpart As Long
End Type

Declare Function QueryPerformanceCounter Lib "kernel32" _
    (lpPerformanceCount As LARGE_INTEGER) _
    As Long

Declare Function CreateCompatibleBitmap Lib "gdi32" _
    (ByVal hdc As Long, _
    ByVal nWidth As Long, _
    ByVal nHeight As Long) _
    As Long

Declare Function CreateCompatibleDC Lib "gdi32" _
    (ByVal hdc As Long) _
    As Long

Declare Function SelectObject Lib "gdi32" _
    (ByVal hdc As Long, _
    ByVal hObject As Long) _
    As Long

Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDc As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal nWidth As Long, _
    ByVal nHeight As Long, _
    ByVal hSrcDC As Long, _
    ByVal xSrc As Long, _
    ByVal ySrc As Long, _
    ByVal dwRop As Long) _
    As Long

Declare Function DeleteDC Lib "gdi32" _
    (ByVal hdc As Long) _
    As Long

Declare Function DeleteObject Lib "gdi32" _
    (ByVal hObject As Long) _
    As Long

Declare Function SetPixelV Lib "gdi32" _
    (ByVal hdc As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal crColor As Long) _
    As Long

Declare Function GetPixel Lib "gdi32" _
    (ByVal hdc As Long, _
    ByVal x As Long, _
    ByVal y As Long) _
    As Long

Declare Function GetTickCount Lib "kernel32" () _
    As Long

Function GetTime() As Long
Dim result As LARGE_INTEGER
Dim a As Long
a = QueryPerformanceCounter(result)
GetTime = result.lowpart
End Function

Sub ShowTimeDiff()
MsgBox "共耗时" & Str((GetTime - Start) / freq) & "秒", vbInformation
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?