это только малая часть. попробуйте нарисовать весь спектр и сделать savepicture!
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Const st = 1 'step
Private Sub Form_Load()
Dim i As Long
Dim j As Long
Dim hd As Long
With Me
.AutoRedraw = True
.Width = 700 * Screen.TwipsPerPixelX
.Height = 500 * Screen.TwipsPerPixelY
End With
hd = Form1.hdc
For j = 0 To 500 Step st 'max 4096
For i = 0 To 700 Step st 'max 4096
SetPixelV hd, Round(i / st), Round(j / st), i * j
Next
Next
Form1.Refresh
End Sub
Private Declare Function SetDIBitsToDevice Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, ByRef Bits As Any, ByRef BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
Private Const DIB_RGB_COLORS As Long = 0
Private Const BI_RGB As Long = 0
Private Sub Form_Load()
Dim i As Long, j As Long, t As Long
Dim bi As BITMAPINFO
Const Step As Long = 1
Const x As Long = 4000 'max 4096
Const y As Long = 4000 'max 4096
Dim c(0 To x - 1, 0 To y - 1) As Long
With Me
.AutoRedraw = True
.Width = Me.ScaleX(700, vbPixels, vbTwips)
.Height = Me.ScaleY(500, vbPixels, vbTwips)
End With
For j = LBound(c, 2) To UBound(c, 2) Step Step
For i = LBound(c, 1) To UBound(c, 1) Step Step
t = i * j
'меняем местами первый байт с третьим, потому что RGBQUAD инвертирована относительно COLORREF
'Впрочем, можно не менять, тогда картинка будет в синих тонах.
c(CLng(i / Step), CLng(j / Step)) = (t And &HFF00FF00) Or (((t And &HFF& * &H10000) Or ((t And &HFF0000) / &H10000))
Next
Next
With bi.bmiHeader
.biSize = Len(bi.bmiHeader)
.biWidth = x
.biHeight = -y
.biPlanes = 1
.biBitCount = 32
.biCompression = BI_RGB
End With
SetDIBitsToDevice Me.hdc, 0, 0, x, y, 0, 0, 0, y, c(LBound(c, 1), LBound(c, 2)), bi, DIB_RGB_COLORS