Using Palette Animation in VB 
Author Message
 Using Palette Animation in VB

Help!

Please could anyone enlighten me as to how to use palette animation
within a VB developed application. Here's an example of the sort of
thing I want to do.

Using Picture1.Line (X,Y) - (X1,Y1), Color, BF I draw a box I then want
to change the color of the box very rapidly without haveing to redraw
the box in the same place with a different color (cause there's lots of
boxes!!) sooo. its sorta

1. Draw Fill rectangle with color
2. Change pallete
3. Refresh Screen
4. Goto 2

Please can someone help a damsel in distress!

Alice x

Sent via Deja.com
http://www.*-*-*.com/



Mon, 02 Jun 2003 20:39:05 GMT  
 Using Palette Animation in VB
This'll do a palette rotation on the picture in an image control (something
I didn't think was possible until Richard Mason posted this a couple of
months ago...

Jim Deutch
MS Dev MVP

Private Type RGBQUAD
    rgbBlue As Byte
    rgbGreen As Byte
    rgbRed As Byte
    rgbReserved As Byte
End Type

Private Declare Function CreateCompatibleDC& Lib "gdi32" (ByVal hDC As Long)
Private Declare Function DeleteDC& Lib "gdi32" (ByVal hDC As Long)
Private Declare Function GetDIBColorTable& Lib "gdi32" (ByVal hDC As Long,
ByVal un1 As Long, ByVal un2 As Long, pRGBQuad As Any)
Private Declare Function SetDIBColorTable& Lib "gdi32" (ByVal hDC As Long,
ByVal un1 As Long, ByVal un2 As Long, pcRGBQuad As Any)
Private Declare Function SelectObject& Lib "gdi32" (ByVal hDC As Long, ByVal
hObject As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()

  Dim lret As Long
  Dim newhDC As Long
  Dim oldhand As Long
  Dim quadarray(255) As Long
  Dim icount As Long
  Dim i As Long
  Dim tmp As Long
  Static busy As Boolean

  busy = Not busy

  Do While True
      DoEvents
      If busy = False Then Exit Do

      newhDC = CreateCompatibleDC(0&)
      oldhand = SelectObject(newhDC, Image1.Picture)

      lret = GetDIBColorTable(newhDC, 0, 256, quadarray(0))

      'One can now modify the color table as required
      tmp = quadarray(0)
      For i = 1 To 255
        quadarray(i - 1) = quadarray(i)
      Next i
      quadarray(255) = tmp

      'Write back the modified color table
      lret = SetDIBColorTable(newhDC, 0, 256, quadarray(0))

      'Cleanup
      SelectObject newhDC, oldhand
      DeleteDC newhDC

      Image1.Refresh
      Sleep 1
    Loop

End Sub


Quote:
> Help!

> Please could anyone enlighten me as to how to use palette animation
> within a VB developed application. Here's an example of the sort of
> thing I want to do.

> Using Picture1.Line (X,Y) - (X1,Y1), Color, BF I draw a box I then want
> to change the color of the box very rapidly without haveing to redraw
> the box in the same place with a different color (cause there's lots of
> boxes!!) sooo. its sorta

> 1. Draw Fill rectangle with color
> 2. Change pallete
> 3. Refresh Screen
> 4. Goto 2

> Please can someone help a damsel in distress!

> Alice x

> Sent via Deja.com
> http://www.deja.com/



Tue, 03 Jun 2003 01:49:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Palette Problem with Animation in Windows

2. Palette Animation w/out API?

3. Palette Animation Problem

4. Palette Animation

5. Palette Animation

6. PALETTE ANIMATION?

7. Animation Controls vs. Palettes

8. Palette Animation

9. palette animation

10. Palette animation w/out API?

11. Urgent! Neep Help in VB Animation using Sprite

12. Direct Animation using transform in VB problem.

 

 
Powered by phpBB® Forum Software