home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / CPU_Usage_222369592012.psc / CPUUsagePro / clsASMpic.cls < prev    next >
Text File  |  2008-07-15  |  17KB  |  478 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsASMpic"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
  15. Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
  16. Option Explicit
  17.  
  18. '************************************************
  19. '* GioRock 2008                                 *
  20. '* some parts of this class code is been erased *
  21. '* to use rotation function only                *
  22. '************************************************
  23.  
  24. 'clsASMpic 1.0
  25. 'Buggy 2002/11
  26. 'use as you like.
  27. 'so far all assembler code by Robert Rayment, big thanks for your great work!
  28.  
  29. 'clsASMpic is a simple class that makes possible REALTIME image manipulation of
  30. 'even large pictures in visual basic.
  31. 'this is accomplished using precompiled assembler code (machine code) in the
  32. 'time critical sections.
  33. 'it has a real wealth of functions, eg rotating and scaling with antialiasing,
  34. 'invertion and grayscaling, art effects like relief and smoothing,
  35. 'colour effects - each colour +/-, brightness and many more - plus some really
  36. 'nice and weird ideas.
  37.  
  38. 'this is mostly a total conversion of one of Robert's former postings, to make
  39. 'using this great technique as easy as it is being fast:
  40. 'http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=29034&lngWId=1
  41. 'also look there for explanation/additional info and more of his great work.
  42.  
  43. 'I did my best to encapsulate everything into one single class and make calling
  44. 'its powerful functions as easy as possible. information hiding at its best.
  45. 'by using enums, the functions become self explanatory.
  46. 'decent error checking, to be improved (for example don't quit your prog until
  47. 'your loop of one degree rotation steps has finished...).
  48. 'even loading and saving pics with the standard dialog is handled.
  49.  
  50. 'this could be made even faster if abandoning undo and reset function:
  51. 'I kept robert's original structure of 3 seperate copies in memory for each image:
  52. '1 - original pic
  53. '2 - current pic
  54. '3 - undo pic
  55. 'if you need only parts of it, rip out the unneeded routines to keep the .exe small.
  56.  
  57. '/// D E C L A R A T I O N S ///////////////////////////////////////////////////
  58.  
  59. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
  60.     (Destination As Any, Source As Any, ByVal Length As Long)
  61. 'To fill BITMAP structure
  62. Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" _
  63.     (ByVal hObject As Long, ByVal Lenbmp As Long, dimbmp As Any) As Long
  64. ' APIs for getting DIB bits to PalBGR
  65. Private Declare Function GetDIBits Lib "gdi32" _
  66.     (ByVal hDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
  67.  
  68. Private Declare Function CreateCompatibleDC Lib "gdi32" _
  69.     (ByVal hDC As Long) As Long
  70.     
  71. Private Declare Function CreateBitmap Lib "Gdi32.dll" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
  72. Private Declare Function CreateCompatibleBitmap Lib "Gdi32.dll" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  73. Private Declare Function SetBkColor Lib "Gdi32.dll" (ByVal hDC As Long, ByVal crColor As Long) As Long
  74. Private Declare Function BitBlt Lib "Gdi32.dll" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal dwRop As Long) As Long
  75. Private Declare Function DeleteObject Lib "Gdi32.dll" (ByVal hObject As Long) As Long
  76.  
  77. Private Declare Function SelectObject Lib "gdi32" _
  78.     (ByVal hDC As Long, ByVal hObject As Long) As Long
  79.  
  80. Private Declare Function DeleteDC Lib "gdi32" _
  81.     (ByVal hDC As Long) As Long
  82.  
  83. Private Declare Function GetDeviceCaps Lib "gdi32" _
  84.     (ByVal hDC As Long, ByVal nIndex As Long) As Long
  85. ' For transferring drawing in an integer array to Form or PicBox
  86. Private Declare Function StretchDIBits Lib "gdi32" (ByVal hDC As Long, _
  87.     ByVal X As Long, ByVal Y As Long, _
  88.     ByVal DesW As Long, ByVal DesH As Long, _
  89.     ByVal SrcX As Long, ByVal SrcY As Long, _
  90.     ByVal PICWW As Long, ByVal PICHH As Long, _
  91.     lpBits As Any, lpBitsInfo As BITMAPINFO, _
  92.     ByVal wUsage As Long, ByVal dwRop As Long) As Long
  93. 'For calling machine code
  94. Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
  95.     (ByVal lpMCode As Long, _
  96.     ByVal Long1 As Long, ByVal Long2 As Single, _
  97.     ByVal Long3 As Single, ByVal Long4 As Long) As Long
  98.  
  99.  
  100. '/// T Y P E S /////////////////////////////////////////////////////////////////
  101.  
  102. Private Type BITMAP
  103.     bmType As Long    ' Type of bitmap
  104.     bmWidth As Long    ' Pixel width
  105.     bmHeight As Long    ' Pixel height
  106.     bmWidthBytes As Long    ' Byte width = 3 x Pixel width
  107.     bmPlanes As Integer    ' Color depth of bitmap
  108.     bmBitsPixel As Integer    ' Bits per pixel, must be 16 or 24
  109.     bmBits As Long    ' This is the pointer to the bitmap data  !!!
  110. End Type
  111. 'NB PICTURE STORED IN MEMORY UPSIDE DOWN
  112. 'WITH INCREASING MEMORY GOING UP THE PICTURE
  113. 'bmp.bmBits points to the bottom left of the picture
  114.  
  115. ' Structures for StretchDIBits
  116. Private Type BITMAPINFOHEADER ' 40 bytes
  117.     biSize As Long
  118.     biwidth As Long
  119.     biheight As Long
  120.     biPlanes As Integer
  121.     biBitCount As Integer
  122.     biCompression As Long
  123.     biSizeImage As Long
  124.     biXPelsPerMeter As Long
  125.     biYPelsPerMeter As Long
  126.     biClrUsed As Long
  127.     biClrImportant As Long
  128. End Type
  129.  
  130. Private Type BITMAPINFO
  131.     bmiH As BITMAPINFOHEADER
  132. 'bmiH As RGBTRIPLE            'NB Palette NOT NEEDED for 16,24 & 32-bit
  133. End Type
  134. 'MCode Structure for parameter passing to machine code functions
  135. Private Type MCodeStruc
  136.     PICW As Long
  137.     PICH As Long
  138.     PtrPalBGR As Long
  139.     PtrPalLineCopy As Long
  140.     Increment As Long
  141.     QBLongColor As Long
  142.     OpCode As Long
  143. End Type
  144.  
  145. '/// E N U M S /////////////////////////////////////////////////////////////////
  146.  
  147. Private Enum eASMBinary
  148.     PICROTATE = 1002
  149. End Enum
  150.  
  151. '/// V A R S ///////////////////////////////////////////////////////////////////
  152.  
  153. Private bm As BITMAPINFO    'Info about pic (colordepth etc)
  154. Private PalLineCopy(1, 1) As Byte    'For copying 1 line of PalBGR()
  155. Private PicRotateMC() As Byte    'Array to hold machine code for Rotations
  156. Private PIC As PictureBox    'Pointer to picbox to manipulate
  157. Private PICW As Long, PICH As Long    'Picbox Width & Height (pixels)
  158. Private PalBGR() As Byte    'To hold 3 full palettes (12 x PICW x PICH)
  159. Private PalSize As Long    'Size of 1 palette (4 x PICW x PICH)
  160. 'finally made these private again as dimming in each subfunction costs time.
  161. Private MCODE As MCodeStruc
  162. Private ptrStruc As Long, ptMC As Long
  163. 'new private to switch autodrawing off, so that large filter arrays dont redraw after each step
  164. Private m_AutoDraw As Boolean
  165.  
  166. Private Const BITSPIXEL = 12
  167.  
  168. Public Sub TransparentBlt(ByVal hDCDst As Long, ByVal DstX As Long, ByVal DstY As Long, ByVal hDCSrc As Long, ByVal SrcX As Long, ByVal SrcY, ByVal SrcW As Long, ByVal SrcH, TransColor As Long)
  169. 'Parameter:
  170.  
  171.     'hDCDst- Device context into which image must be
  172.     'drawn transparently
  173.     
  174.     'hDCSrc- Device context of source to be made transparent
  175.     'in color TransColor
  176.     
  177.     'SrcX, SrcY, SrcW, SrcH - Rectangular region within
  178.     'hDCSrc to be made transparent in terms of hDCDst,
  179.     'and drawn to hDCDst
  180.     
  181.     'DstX, DstY - Coordinates in hDCDst (and hDCDst)
  182.     'where the transparent bitmap must go.
  183.     
  184.     'TransColor - Transparent Color.
  185. '-------------------------
  186.  
  187. Dim MonoMaskDC As Long, hMonoMask As Long
  188. Dim MonoInvDC As Long, hMonoInv As Long
  189. Dim ResulthDCDst As Long, hResultDst As Long
  190. Dim ResulthDCSrc As Long, hResultSrc As Long
  191. Dim hPrevMask As Long, hPrevInv As Long
  192. Dim hPrevSrc As Long, hPrevDst As Long
  193. Dim nRet As Long
  194.  
  195.     'create monochrome mask and inverse masks
  196.     MonoMaskDC = CreateCompatibleDC(hDCDst)
  197.     MonoInvDC = CreateCompatibleDC(hDCDst)
  198.     hMonoMask = CreateBitmap(SrcW, SrcH, 1, 1, ByVal 0&)
  199.     hMonoInv = CreateBitmap(SrcW, SrcH, 1, 1, ByVal 0&)
  200.     hPrevMask = SelectObject(MonoMaskDC, hMonoMask)
  201.     hPrevInv = SelectObject(MonoInvDC, hMonoInv)
  202.    
  203.     'create keeper DCs and bitmaps
  204.     ResulthDCDst = CreateCompatibleDC(hDCDst)
  205.     ResulthDCSrc = CreateCompatibleDC(hDCDst)
  206.     hResultDst = CreateCompatibleBitmap(hDCDst, SrcW, SrcH)
  207.     hResultSrc = CreateCompatibleBitmap(hDCDst, SrcW, SrcH)
  208.     hPrevDst = SelectObject(ResulthDCDst, hResultDst)
  209.     hPrevSrc = SelectObject(ResulthDCSrc, hResultSrc)
  210.    
  211.     'copy src to monochrome mask
  212.     Dim OldBC As Long
  213.     OldBC = SetBkColor(hDCSrc, TransColor)
  214.     nRet = BitBlt(MonoMaskDC, 0, 0, SrcW, SrcH, hDCSrc, SrcX, SrcY, vbSrcCopy)
  215.     TransColor = SetBkColor(hDCSrc, OldBC)
  216.    
  217.     'create inverse of mask
  218.     nRet = BitBlt(MonoInvDC, 0, 0, SrcW, SrcH, MonoMaskDC, 0, 0, vbNotSrcCopy)
  219.    
  220.     'get background
  221.     nRet = BitBlt(ResulthDCDst, 0, 0, SrcW, SrcH, hDCDst, DstX, DstY, vbSrcCopy)
  222.    
  223.     'AND with Monochrome mask
  224.     nRet = BitBlt(ResulthDCDst, 0, 0, SrcW, SrcH, MonoMaskDC, 0, 0, vbSrcAnd)
  225.    
  226.     'get overlapper
  227.     nRet = BitBlt(ResulthDCSrc, 0, 0, SrcW, SrcH, hDCSrc, SrcX, SrcY, vbSrcCopy)
  228.    
  229.     'AND with inverse monochrome mask
  230.     nRet = BitBlt(ResulthDCSrc, 0, 0, SrcW, SrcH, MonoInvDC, 0, 0, vbSrcAnd)
  231.    
  232.     'XOR these two
  233.     nRet = BitBlt(ResulthDCDst, 0, 0, SrcW, SrcH, ResulthDCSrc, 0, 0, vbSrcInvert)
  234.    
  235.     'Display Transparent Image.
  236.     nRet = BitBlt(hDCDst, DstX, DstY, SrcW, SrcH, ResulthDCDst, 0, 0, vbSrcCopy)
  237.    
  238.     'Free resource.
  239.     hMonoMask = SelectObject(MonoMaskDC, hPrevMask)
  240.     DeleteObject hMonoMask
  241.  
  242.     hMonoInv = SelectObject(MonoInvDC, hPrevInv)
  243.     DeleteObject hMonoInv
  244.  
  245.     hResultDst = SelectObject(ResulthDCDst, hPrevDst)
  246.     DeleteObject hResultDst
  247.  
  248.     hResultSrc = SelectObject(ResulthDCSrc, hPrevSrc)
  249.     DeleteObject hResultSrc
  250.  
  251.     DeleteDC MonoMaskDC
  252.     DeleteDC MonoInvDC
  253.     DeleteDC ResulthDCDst
  254.     DeleteDC ResulthDCSrc
  255.     
  256. End Sub
  257. Public Function UndoLast()
  258.     If NoPicAssigned Then Exit Function
  259.     CopyMemory PalBGR(1, 1, 1, 2), PalBGR(1, 1, 1, 3), PalSize
  260.     ShowPalBGR 2
  261. End Function
  262. Public Property Let PictureBox(ByRef PicBox As PictureBox)
  263. Attribute PictureBox.VB_UserMemId = 0
  264.     On Error GoTo InitializeError
  265.     Set PIC = PicBox
  266.     PICW = PIC.Width
  267.     PICH = PIC.Height
  268.     If Not SysBPPok(PIC) Then
  269.         Set PIC = Nothing
  270.         MsgBox "Not 16 or 24-bit color setting", vbCritical, "clsASM"
  271.         Exit Property
  272.     End If
  273.     MCODE.PICW = PICW
  274.     MCODE.PICH = PICH
  275.     ptrStruc = VarPtr(MCODE.PICW)
  276. '---------------------
  277.     GeneratePalBGRs
  278.     MCODE.PtrPalBGR = VarPtr(PalBGR(1, 1, 1, 1))
  279.     MCODE.PtrPalLineCopy = VarPtr(PalLineCopy(1, 1))
  280. '---------------------
  281.     ShowPalBGR 3
  282. '---------------------
  283.     Exit Property
  284. InitializeError:
  285.     Set PIC = Nothing
  286.     MsgBox "Couldn't assign picturebox", vbCritical, "clsASM"
  287. End Property
  288.  
  289. Public Property Let AutoDraw(autoON As Boolean)
  290.     m_AutoDraw = autoON
  291.     If autoON Then
  292.         ShowPalBGR 2 'if switched on again, draw last pic
  293.     Else 'if switched off, update undo buffer
  294.         CopyMemory PalBGR(1, 1, 1, 3), PalBGR(1, 1, 1, 2), PalSize
  295.     End If
  296. End Property
  297. Public Property Get AutoDraw() As Boolean
  298.     AutoDraw = m_AutoDraw
  299. End Property
  300.  
  301. Public Function DrawNow()
  302.     ShowPalBGR 2
  303.     DoEvents
  304. End Function
  305.  
  306. Private Function NoPicAssigned() As Boolean
  307.     If PIC Is Nothing Then
  308.         NoPicAssigned = True
  309.         MsgBox "You must assign a picturebox to the class first!", vbInformation, "clsASM"
  310.     Else
  311.         NoPicAssigned = False
  312.     End If
  313. End Function
  314.  
  315. Public Function ASM_Rotate(ByVal Angle As Integer, Optional ByVal AntiAlias As Boolean = False, Optional ByVal SourcePic As Boolean = True, Optional ByVal colorX As Long = -1, Optional ByVal centerX As Variant, Optional ByVal centerY As Variant)
  316.     
  317.     If NoPicAssigned Then Exit Function
  318.     
  319.     If Angle = 0 Then Exit Function
  320.  
  321.     If Not SourcePic Then
  322.         If m_AutoDraw Then
  323.             CopyMemory PalBGR(1, 1, 1, 3), PalBGR(1, 1, 1, 2), PalSize
  324.         End If
  325.     End If
  326.  
  327.     If colorX < 0 Then colorX = PIC.BackColor
  328.  
  329. 'centerX and centerY are passed as variant because the use of IsMissing is only possible with type variant
  330. 'if i used "optional centerx as long = -1" and checked for -1 as default value, rotating about this
  331. 'coordinate would be impossible...
  332.     If IsMissing(centerX) Then centerX = PICW \ 2
  333.     If IsMissing(centerY) Then centerY = PICH \ 2
  334.  
  335.     MCODE.QBLongColor = colorX
  336.     ptMC = VarPtr(PicRotateMC(0))
  337.  
  338.     If SourcePic Then
  339.         MCODE.OpCode = 2
  340.     Else
  341.         MCODE.OpCode = 0
  342.     End If
  343.     If AntiAlias Then
  344.         MCODE.OpCode = MCODE.OpCode + 1
  345.     End If
  346.     
  347.     CallWindowProc ptMC, ptrStruc, centerX, centerY, Angle + 360
  348.     
  349.     If m_AutoDraw Then
  350.         ShowPalBGR 2
  351.     End If
  352.  
  353. End Function
  354.  
  355. Private Function LoadMCodeFromString(asm_code_ARRAY() As Byte, ID_ASM As eASMBinary)
  356.     asm_code_ARRAY = LoadResData(ID_ASM, "CUSTOM")
  357. End Function
  358.  
  359. Private Function GeneratePalBGRs()
  360.     GETDIBS PIC.Image
  361. ' Mem storage
  362. 'PalBGR for 32 bitcount
  363. ' BLUE     GREEN     RED       ALPHA
  364. '(1,1,1,1)(2,1,1,1),(3,1,1,1),(4,1,1,1),,,(1,X,1,1),(2,X,1,1),(3,X,1,1),(4,X,1,1)
  365. '(1,1,Y,1)(2,1,Y,1),(3,1,Y,1),(4,1,1,1),,,(1,X,Y,1),(2,X,Y,1),(3,X,Y,1),(4,X,Y,1)
  366. '-----------------------------------------------------------------------------------
  367. '(1,1,1,2)(2,1,1,2),(3,1,1,2),(4,1,1,2),,,(1,X,1,2),(2,X,1,2),(3,X,1,2),(4,X,1,2)
  368. '(1,1,Y,2)(2,1,Y,1),(3,1,Y,1),(4,1,1,1),,,(1,X,Y,2),(2,X,Y,2),(3,X,Y,2),(4,X,Y,2)
  369. '-----------------------------------------------------------------------------------
  370. '(1,1,1,3)(2,1,1,3),(3,1,1,3),(4,1,1,3),,,(1,X,1,3),(2,X,1,3),(3,X,1,3),(4,X,1,3)
  371. '(1,1,Y,3)(2,1,Y,3),(3,1,Y,3),(4,1,Y,3),,,(1,X,Y,3),(2,X,Y,3),(3,X,Y,3),(4,X,Y,3)
  372. '-----------------------------------------------------------------------------------
  373. ' Save 2 copies of palette
  374.     PalSize = 4 * PICW * PICH    ' Bytes
  375.     CopyMemory PalBGR(1, 1, 1, 2), PalBGR(1, 1, 1, 1), PalSize
  376.     CopyMemory PalBGR(1, 1, 1, 3), PalBGR(1, 1, 1, 1), PalSize
  377. End Function
  378.  
  379. Private Function GETDIBS(ByVal PICIM As Long)
  380. Dim NewDC As Long, OldH As Long
  381. Dim BytesPerScanLine As Long, PadBytesPerScanLine As Long
  382. Dim bmp As BITMAP
  383.  
  384.     On Error GoTo DIBError
  385.  
  386. 'Get info on picture loaded into PIC
  387.     GetObjectAPI PICIM, Len(bmp), bmp
  388.  
  389.     NewDC = CreateCompatibleDC(0&)
  390.     OldH = SelectObject(NewDC, PICIM)
  391.  
  392. ' Set up bm struc for GetDIBits & StretchDIBits
  393.     With bm.bmiH
  394.         .biSize = 40
  395.         .biwidth = bmp.bmWidth
  396.         .biheight = bmp.bmHeight
  397.         .biPlanes = 1
  398.         .biBitCount = 32    ' Sets up BGRA pixels
  399.         .biCompression = 0
  400.         BytesPerScanLine = ((((.biwidth * .biBitCount) + 31) \ 32) * 4)
  401.         PadBytesPerScanLine = _
  402.         BytesPerScanLine - (((.biwidth * .biBitCount) + 7) \ 8)
  403.         .biSizeImage = BytesPerScanLine * Abs(.biheight)
  404.     End With
  405.  
  406. ' Set PalBGR to receive color bytes
  407.     ReDim PalBGR(1 To 4, 1 To PICW, 1 To PICH, 1 To 3) As Byte
  408. ' Load color bytes to 1st third of PalBGR
  409.     GetDIBits NewDC, PICIM, 0, PICH, PalBGR(1, 1, 1, 1), bm, 1
  410. ' Clear mem
  411.     SelectObject NewDC, OldH
  412.  
  413.     DeleteDC NewDC
  414.     
  415.     Exit Function
  416.     
  417. '==========
  418. DIBError:
  419.     MsgBox "Error in function GETDIBS", vbCritical, "clsASM"
  420.     On Error GoTo 0
  421. End Function
  422.  
  423. Private Function ShowPalBGR(N)
  424. ' Blit PalBGR(N) to PIC
  425. ' N= 1,2 or 3
  426.     PIC.Picture = LoadPicture()
  427.     PIC.Visible = True
  428.  
  429.     Dim PalBGRPtr As Long    ' Pointer to PalBGR(1,1,1,1)
  430.     PalBGRPtr = VarPtr(PalBGR(1, 1, 1, N))
  431.  
  432.     bm.bmiH.biwidth = PICW
  433.     bm.bmiH.biheight = PICH
  434.     If StretchDIBits(ByVal PIC.hDC, _
  435.         0, 0, _
  436.         PICW, PICH, _
  437.         0, 0, _
  438.         PICW, PICH, _
  439.         ByVal PalBGRPtr, bm, _
  440.         1, vbSrcCopy) = 0 Then
  441.         Erase PalBGR
  442.         MsgBox "Blit Error", vbCritical, "clsASM"
  443.         End
  444.     End If
  445.  
  446.     PIC.Refresh
  447.     
  448. End Function
  449.  
  450. Private Function SysBPPok(PIC As PictureBox) As Boolean
  451. Dim SysBPP As Long
  452.     SysBPP = GetDeviceCaps(PIC.hDC, BITSPIXEL)    'HORZRES = 8, VERTRES = 10, BITSPIXEL = 12
  453.     If SysBPP <> 16 And SysBPP <> 32 Then    '16, 32 (24-bit BGR)
  454.         SysBPPok = False
  455.     Else
  456.         SysBPPok = True
  457.     End If
  458. End Function
  459.  
  460. Public Function ResetPic()
  461.     If NoPicAssigned Then Exit Function
  462.     CopyMemory PalBGR(1, 1, 1, 2), PalBGR(1, 1, 1, 1), PalSize
  463.     CopyMemory PalBGR(1, 1, 1, 3), PalBGR(1, 1, 1, 1), PalSize
  464.     ShowPalBGR 1
  465. End Function
  466.  
  467. Private Sub Class_Initialize()
  468.     m_AutoDraw = True
  469. 'load all those mutthas...
  470.     LoadMCodeFromString PicRotateMC, PICROTATE
  471. End Sub
  472.  
  473. Private Sub Class_Terminate()
  474.     Erase PalBGR
  475.     Erase PicRotateMC
  476.     Set PIC = Nothing
  477. End Sub
  478.