|
-
Feb 4th, 2001, 11:53 PM
#1
Thread Starter
New Member
What is the most compact and simple way to take a 50x50 array of color values and blit that into a 50x50 picturebox. Sorry if you've heard this one before.
- // /\/\atrix // -
-
Feb 5th, 2001, 12:24 AM
#2
Fanatic Member
The SetPixelV would probably be the fastest way to draw directly to the picturebox. If this isn't fast enough you can draw directly to an offscreen DC and then just blt it directly from memory into the picture box (alot more code), let me know if you need an example for that....
Code:
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Sub Form_Load()
Dim iX As Integer
Dim iY As Integer
Dim lColorArray(0 To 50, 0 To 50)
' resize picture box to 50 X 50 pixels
Picture1.Height = 50 * Screen.TwipsPerPixelX
Picture1.Width = 50 * Screen.TwipsPerPixelY
Picture1.AutoRedraw = True
' fill the array with random colors
For iX = 0 To 50
For iY = 0 To 50
lColorArray(iX, iY) = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next iY
Next iX
' set the pixel's color
For iX = 0 To 50
For iY = 0 To 50
SetPixelV Picture1.hdc, iX, iY, lColorArray(iX, iY)
Next iY
Next iX
End Sub
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Feb 5th, 2001, 12:45 AM
#3
Thread Starter
New Member
Worked like a charm
Thank you! That worked wonderfully.
-
Feb 5th, 2001, 08:11 PM
#4
Good Ol' Platypus
However, YoungBuck, I would code for that...
So far i'm getting a frame every 9 secs for a 640x480 picture w/ get & setpixelV
(but i'll be using DDraw soon)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|