[Visual Basic] 纯文本查看 复制代码VERSION 5.00
Begin VB.Form frmMain
Caption = "取得调色板"
ClientHeight = 6465
ClientLeft = 120
ClientTop = 450
ClientWidth = 16440
LinkTopic = "frmMain"
OLEDropMode = 1 'Manual
ScaleHeight = 431
ScaleMode = 3 'Pixel
ScaleWidth = 1096
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox picDither
Align = 3 'Align Left
BorderStyle = 0 'None
Height = 6465
Left = 0
ScaleHeight = 431
ScaleMode = 3 'Pixel
ScaleWidth = 457
TabIndex = 6
Top = 0
Visible = 0 'False
Width = 6855
Begin VB.HScrollBar HSDither
Height = 255
Left = 1440
Max = 0
TabIndex = 12
TabStop = 0 'False
Top = 3000
Width = 2415
End
Begin VB.PictureBox picColor4
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Left = 1800
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 33
TabIndex = 11
Top = 0
Visible = 0 'False
Width = 495
End
Begin VB.PictureBox picColor3
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Left = 1200
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 33
TabIndex = 10
Top = 0
Visible = 0 'False
Width = 495
End
Begin VB.PictureBox picColor2
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Left = 600
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 33
TabIndex = 9
Top = 0
Visible = 0 'False
Width = 495
End
Begin VB.PictureBox picColor1
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Left = 0
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 33
TabIndex = 8
Top = 0
Visible = 0 'False
Width = 495
End
Begin VB.PictureBox picResult
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 495
Left = 2400
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 33
TabIndex = 7
Top = 0
Visible = 0 'False
Width = 495
End
End
Begin VB.PictureBox picRightPanel
Align = 4 'Align Right
BorderStyle = 0 'None
Height = 6465
Left = 15345
ScaleHeight = 431
ScaleMode = 3 'Pixel
ScaleWidth = 73
TabIndex = 0
Top = 0
Width = 1095
Begin VB.PictureBox picProgress
BackColor = &H8000000C&
Height = 255
Left = 0
ScaleHeight = 13
ScaleMode = 3 'Pixel
ScaleWidth = 69
TabIndex = 14
Top = 4320
Width = 1095
Begin VB.CommandButton cmdProgress
Enabled = 0 'False
Height = 195
Left = 0
Style = 1 'Graphical
TabIndex = 15
Top = 0
Width = 1035
End
End
Begin VB.CheckBox ChRandomPalette
Caption = "产生随机调色板"
Height = 615
Left = 0
Style = 1 'Graphical
TabIndex = 13
Top = 3600
Width = 1095
End
Begin VB.PictureBox picPal
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 1095
Left = 0
ScaleHeight = 73
ScaleMode = 3 'Pixel
ScaleWidth = 73
TabIndex = 5
Top = 2400
Width = 1095
End
Begin VB.OptionButton OpDitherPic
Caption = "抖动图"
Enabled = 0 'False
Height = 495
Left = 0
Style = 1 'Graphical
TabIndex = 4
Top = 1920
Value = -1 'True
Width = 1095
End
Begin VB.OptionButton OpSrcPic
Caption = "原图"
Enabled = 0 'False
Height = 495
Left = 0
Style = 1 'Graphical
TabIndex = 3
Top = 1440
Width = 1095
End
Begin VB.CommandButton cmdDither
Caption = "抖动"
Enabled = 0 'False
Height = 615
Left = 0
TabIndex = 1
Top = 0
Width = 1095
End
End
Begin VB.PictureBox picSrcPic
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 255
Left = 0
ScaleHeight = 255
ScaleWidth = 135
TabIndex = 2
Top = 0
Visible = 0 'False
Width = 135
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'==============================================================================
'作者:0xAA55
'论坛:http://www.0xaa55.com/
'版权所有 (C) 2013-2014 技术宅的结界
'请保留原作者信息,否则视为侵权。
'------------------------------------------------------------------------------
Option Explicit
Private Const COLORS_MAX As Long = 256
Private Const COLORS_BITS As Long = 8
Private Const DIST_MAX As Long = 200000
Private Type RGBQUAD
B As Byte
G As Byte
R As Byte
X As Byte
End Typ