home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / transp1a / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-05-28  |  28.3 KB  |  715 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  3. Object = "{38911DA0-E448-11D0-84A3-00DD01104159}#1.1#0"; "COMCT332.OCX"
  4. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
  5. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  6. Begin VB.Form frmMain 
  7.    AutoRedraw      =   -1  'True
  8.    Caption         =   "Transparency/Translucency Mask and Image Creator"
  9.    ClientHeight    =   4350
  10.    ClientLeft      =   165
  11.    ClientTop       =   720
  12.    ClientWidth     =   7065
  13.    Icon            =   "frmMain.frx":0000
  14.    LinkTopic       =   "Form1"
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   290
  17.    ScaleMode       =   3  'Pixel
  18.    ScaleWidth      =   471
  19.    StartUpPosition =   3  'Windows Default
  20.    Begin VB.PictureBox pImageView 
  21.       Align           =   1  'Align Top
  22.       AutoRedraw      =   -1  'True
  23.       BackColor       =   &H00800000&
  24.       BorderStyle     =   0  'None
  25.       Height          =   3105
  26.       Left            =   0
  27.       ScaleHeight     =   207
  28.       ScaleMode       =   3  'Pixel
  29.       ScaleWidth      =   471
  30.       TabIndex        =   4
  31.       Top             =   1245
  32.       Width           =   7065
  33.    End
  34.    Begin MSComDlg.CommonDialog cDia 
  35.       Left            =   2700
  36.       Top             =   1860
  37.       _ExtentX        =   847
  38.       _ExtentY        =   847
  39.       _Version        =   393216
  40.       CancelError     =   -1  'True
  41.       DialogTitle     =   "Select Image"
  42.       Filter          =   "Bitmap Files (*.bmp)|*.bmp"
  43.       Flags           =   4
  44.    End
  45.    Begin ComCtl3.CoolBar cbTB 
  46.       Align           =   1  'Align Top
  47.       Height          =   1245
  48.       Left            =   0
  49.       TabIndex        =   0
  50.       Top             =   0
  51.       Width           =   7065
  52.       _ExtentX        =   12462
  53.       _ExtentY        =   2196
  54.       FixedOrder      =   -1  'True
  55.       _CBWidth        =   7065
  56.       _CBHeight       =   1245
  57.       _Version        =   "6.0.8169"
  58.       Child1          =   "tbGen"
  59.       MinHeight1      =   26
  60.       Width1          =   7
  61.       NewRow1         =   0   'False
  62.       Child2          =   "pOptions"
  63.       MinHeight2      =   23
  64.       Width2          =   9
  65.       NewRow2         =   -1  'True
  66.       Child3          =   "tbView"
  67.       MinHeight3      =   26
  68.       Width3          =   7
  69.       NewRow3         =   -1  'True
  70.       Begin VB.PictureBox pOptions 
  71.          BorderStyle     =   0  'None
  72.          Height          =   345
  73.          Left            =   165
  74.          ScaleHeight     =   23
  75.          ScaleMode       =   3  'Pixel
  76.          ScaleWidth      =   454
  77.          TabIndex        =   12
  78.          Top             =   450
  79.          Width           =   6810
  80.          Begin VB.ComboBox cboStyle 
  81.             Height          =   315
  82.             ItemData        =   "frmMain.frx":014A
  83.             Left            =   3450
  84.             List            =   "frmMain.frx":0154
  85.             Style           =   2  'Dropdown List
  86.             TabIndex        =   15
  87.             Top             =   30
  88.             Width           =   2115
  89.          End
  90.          Begin VB.CheckBox chkUseTransL 
  91.             Caption         =   "Use Translucency"
  92.             Height          =   255
  93.             Left            =   1710
  94.             TabIndex        =   14
  95.             Top             =   60
  96.             Value           =   1  'Checked
  97.             Width           =   1635
  98.          End
  99.          Begin VB.CheckBox chkUseTransP 
  100.             Caption         =   "Use Transparency"
  101.             Height          =   255
  102.             Left            =   0
  103.             TabIndex        =   13
  104.             Top             =   60
  105.             Value           =   1  'Checked
  106.             Width           =   1635
  107.          End
  108.       End
  109.       Begin MSComctlLib.Toolbar tbView 
  110.          Height          =   390
  111.          Left            =   165
  112.          TabIndex        =   3
  113.          Top             =   825
  114.          Width           =   6810
  115.          _ExtentX        =   12012
  116.          _ExtentY        =   688
  117.          ButtonWidth     =   609
  118.          ButtonHeight    =   582
  119.          ImageList       =   "imlToolbarIcons(1)"
  120.          _Version        =   393216
  121.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  122.             NumButtons      =   4
  123.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  124.                Enabled         =   0   'False
  125.                Key             =   "Starting Image"
  126.                Object.ToolTipText     =   "View Starting Image"
  127.                ImageKey        =   "cimage"
  128.                Style           =   2
  129.                Value           =   1
  130.             EndProperty
  131.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  132.                Enabled         =   0   'False
  133.                Key             =   "Compiled Image"
  134.                Object.ToolTipText     =   "View Compiled Image"
  135.                ImageKey        =   "cimage2"
  136.                Style           =   2
  137.             EndProperty
  138.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  139.                Enabled         =   0   'False
  140.                Key             =   "Mask"
  141.                Object.ToolTipText     =   "View Mask"
  142.                ImageKey        =   "cmask"
  143.                Style           =   2
  144.             EndProperty
  145.             BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  146.                Enabled         =   0   'False
  147.                Key             =   "Put-together Image"
  148.                Object.ToolTipText     =   "View Put-together Image"
  149.                ImageKey        =   "finished"
  150.                Style           =   2
  151.             EndProperty
  152.          EndProperty
  153.       End
  154.       Begin MSComctlLib.Toolbar tbGen 
  155.          Height          =   390
  156.          Left            =   30
  157.          TabIndex        =   1
  158.          Top             =   30
  159.          Width           =   6945
  160.          _ExtentX        =   12250
  161.          _ExtentY        =   688
  162.          ButtonWidth     =   609
  163.          ButtonHeight    =   582
  164.          ImageList       =   "imlToolbarIcons(0)"
  165.          _Version        =   393216
  166.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  167.             NumButtons      =   10
  168.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  169.                Key             =   "Open"
  170.                Object.ToolTipText     =   "Open"
  171.                ImageKey        =   "Open"
  172.             EndProperty
  173.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  174.                Key             =   "Save"
  175.                Object.ToolTipText     =   "Save"
  176.                ImageKey        =   "Save"
  177.             EndProperty
  178.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.                Style           =   3
  180.             EndProperty
  181.             BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  182.                Enabled         =   0   'False
  183.                Key             =   "Compile"
  184.                Object.ToolTipText     =   "Compile Images"
  185.                ImageKey        =   "Compile"
  186.             EndProperty
  187.             BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  188.                Style           =   3
  189.             EndProperty
  190.             BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  191.                Key             =   "TransPColorPH"
  192.                Style           =   4
  193.                Object.Width           =   1635
  194.             EndProperty
  195.             BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  196.                Style           =   3
  197.             EndProperty
  198.             BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  199.                Key             =   "TransLColorPH"
  200.                Style           =   4
  201.                Object.Width           =   1635
  202.             EndProperty
  203.             BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  204.                Style           =   3
  205.             EndProperty
  206.             BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  207.                Key             =   "TransLLevelPH"
  208.                Style           =   4
  209.                Object.Width           =   1425
  210.             EndProperty
  211.          EndProperty
  212.          Begin VB.PictureBox pTranslLevelP 
  213.             BorderStyle     =   0  'None
  214.             Height          =   315
  215.             Left            =   5160
  216.             ScaleHeight     =   315
  217.             ScaleWidth      =   1425
  218.             TabIndex        =   16
  219.             Top             =   60
  220.             Width           =   1425
  221.             Begin VB.TextBox txtTransLP 
  222.                Height          =   315
  223.                Left            =   0
  224.                TabIndex        =   18
  225.                Text            =   "50"
  226.                Top             =   0
  227.                Width           =   1050
  228.             End
  229.             Begin MSComCtl2.UpDown UDTransLP 
  230.                Height          =   315
  231.                Left            =   1051
  232.                TabIndex        =   17
  233.                Top             =   0
  234.                Width           =   195
  235.                _ExtentX        =   344
  236.                _ExtentY        =   556
  237.                _Version        =   393216
  238.                Value           =   50
  239.                AutoBuddy       =   -1  'True
  240.                BuddyControl    =   "txtTransLP"
  241.                BuddyDispid     =   196615
  242.                OrigLeft        =   1020
  243.                OrigRight       =   1215
  244.                OrigBottom      =   315
  245.                Max             =   100
  246.                Min             =   1
  247.                SyncBuddy       =   -1  'True
  248.                BuddyProperty   =   65547
  249.                Enabled         =   -1  'True
  250.             End
  251.             Begin VB.Label Label1 
  252.                Alignment       =   1  'Right Justify
  253.                AutoSize        =   -1  'True
  254.                BackStyle       =   0  'Transparent
  255.                Caption         =   "%"
  256.                Height          =   195
  257.                Left            =   1275
  258.                TabIndex        =   19
  259.                Top             =   30
  260.                Width           =   120
  261.             End
  262.          End
  263.          Begin VB.PictureBox pTransLColorP 
  264.             BorderStyle     =   0  'None
  265.             Height          =   255
  266.             Left            =   3060
  267.             ScaleHeight     =   255
  268.             ScaleWidth      =   1635
  269.             TabIndex        =   9
  270.             Top             =   90
  271.             Width           =   1635
  272.             Begin VB.PictureBox pTransLColorB 
  273.                BackColor       =   &H007595FF&
  274.                Height          =   180
  275.                Left            =   0
  276.                ScaleHeight     =   120
  277.                ScaleWidth      =   225
  278.                TabIndex        =   10
  279.                ToolTipText     =   "Double Click To Change  &H7595FF&"
  280.                Top             =   0
  281.                Width           =   285
  282.             End
  283.             Begin VB.Label lPTransLColorB 
  284.                AutoSize        =   -1  'True
  285.                Caption         =   "Translucent Color"
  286.                Height          =   195
  287.                Left            =   300
  288.                TabIndex        =   11
  289.                Top             =   0
  290.                Width           =   1245
  291.             End
  292.          End
  293.          Begin VB.PictureBox pTransPColorP 
  294.             BorderStyle     =   0  'None
  295.             Height          =   255
  296.             Left            =   1230
  297.             ScaleHeight     =   255
  298.             ScaleWidth      =   1635
  299.             TabIndex        =   6
  300.             Top             =   90
  301.             Width           =   1635
  302.             Begin VB.PictureBox pTransPColorB 
  303.                BackColor       =   &H002D2D2D&
  304.                Height          =   255
  305.                Left            =   0
  306.                ScaleHeight     =   195
  307.                ScaleWidth      =   225
  308.                TabIndex        =   8
  309.                ToolTipText     =   "Double Click To Change  &H2D2D2D"
  310.                Top             =   0
  311.                Width           =   285
  312.             End
  313.             Begin VB.Label lPTransPColorB 
  314.                AutoSize        =   -1  'True
  315.                BackStyle       =   0  'Transparent
  316.                Caption         =   "Transparent Color"
  317.                Height          =   195
  318.                Left            =   330
  319.                TabIndex        =   7
  320.                Top             =   30
  321.                Width           =   1260
  322.             End
  323.          End
  324.       End
  325.    End
  326.    Begin MSComctlLib.ImageList imlToolbarIcons 
  327.       Index           =   0
  328.       Left            =   3660
  329.       Top             =   3150
  330.       _ExtentX        =   1005
  331.       _ExtentY        =   1005
  332.       BackColor       =   -2147483643
  333.       ImageWidth      =   16
  334.       ImageHeight     =   16
  335.       MaskColor       =   12632256
  336.       _Version        =   393216
  337.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  338.          NumListImages   =   3
  339.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  340.             Picture         =   "frmMain.frx":0178
  341.             Key             =   "Open"
  342.          EndProperty
  343.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  344.             Picture         =   "frmMain.frx":028A
  345.             Key             =   "Save"
  346.          EndProperty
  347.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  348.             Picture         =   "frmMain.frx":039C
  349.             Key             =   "Compile"
  350.          EndProperty
  351.       EndProperty
  352.    End
  353.    Begin MSComctlLib.ImageList imlToolbarIcons 
  354.       Index           =   1
  355.       Left            =   1605
  356.       Top             =   1965
  357.       _ExtentX        =   1005
  358.       _ExtentY        =   1005
  359.       BackColor       =   -2147483643
  360.       ImageWidth      =   16
  361.       ImageHeight     =   16
  362.       MaskColor       =   12632256
  363.       _Version        =   393216
  364.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  365.          NumListImages   =   5
  366.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  367.             Picture         =   "frmMain.frx":04F8
  368.             Key             =   "cimage"
  369.          EndProperty
  370.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  371.             Picture         =   "frmMain.frx":06D2
  372.             Key             =   "cimage2"
  373.          EndProperty
  374.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  375.             Picture         =   "frmMain.frx":08AC
  376.             Key             =   "cmask"
  377.          EndProperty
  378.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  379.             Picture         =   "frmMain.frx":0A86
  380.             Key             =   "ctrans"
  381.          EndProperty
  382.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  383.             Picture         =   "frmMain.frx":0C60
  384.             Key             =   "finished"
  385.          EndProperty
  386.       EndProperty
  387.    End
  388.    Begin VB.PictureBox pWork 
  389.       AutoRedraw      =   -1  'True
  390.       AutoSize        =   -1  'True
  391.       BorderStyle     =   0  'None
  392.       Height          =   900
  393.       Left            =   4200
  394.       ScaleHeight     =   60
  395.       ScaleMode       =   3  'Pixel
  396.       ScaleWidth      =   105
  397.       TabIndex        =   2
  398.       Top             =   2910
  399.       Visible         =   0   'False
  400.       Width           =   1575
  401.    End
  402.    Begin VB.PictureBox pWSize 
  403.       AutoRedraw      =   -1  'True
  404.       AutoSize        =   -1  'True
  405.       BorderStyle     =   0  'None
  406.       Height          =   525
  407.       Left            =   1560
  408.       ScaleHeight     =   35
  409.       ScaleMode       =   3  'Pixel
  410.       ScaleWidth      =   83
  411.       TabIndex        =   5
  412.       Top             =   2850
  413.       Visible         =   0   'False
  414.       Width           =   1245
  415.    End
  416.    Begin MSComDlg.CommonDialog cDiaColor 
  417.       Left            =   2700
  418.       Top             =   1980
  419.       _ExtentX        =   847
  420.       _ExtentY        =   847
  421.       _Version        =   393216
  422.       CancelError     =   -1  'True
  423.    End
  424.    Begin VB.Timer tEnableCheck 
  425.       Interval        =   200
  426.       Left            =   1620
  427.       Top             =   1980
  428.    End
  429.    Begin VB.Menu mnuFile 
  430.       Caption         =   "&File"
  431.       Begin VB.Menu mnuFileSave 
  432.          Caption         =   "&Save"
  433.          Shortcut        =   ^S
  434.       End
  435.       Begin VB.Menu mnuFileOpen 
  436.          Caption         =   "&Open"
  437.          Shortcut        =   ^O
  438.       End
  439.       Begin VB.Menu mnuFileS2 
  440.          Caption         =   "-"
  441.       End
  442.       Begin VB.Menu mnuFileExit 
  443.          Caption         =   "E&xit"
  444.       End
  445.    End
  446. Attribute VB_Name = "frmMain"
  447. Attribute VB_GlobalNameSpace = False
  448. Attribute VB_Creatable = False
  449. Attribute VB_PredeclaredId = True
  450. Attribute VB_Exposed = False
  451. Private Quitting As Boolean
  452. Private nB As StdPicture
  453. Private nFileName As String
  454. Private Changed As Boolean
  455. Private nCIQ As New CImgQuad
  456. Private nView As String
  457. Private Compiled As Boolean
  458. Private Const mDCTC As String = "Double Click To Change"
  459. Private Sub cboStyle_Click()
  460. nCIQ.Style = cboStyle.ListIndex
  461. End Sub
  462. Private Sub chkUseTransL_Click()
  463.     nCIQ.UseTranslucency = chkUseTransL.Value And 1
  464. End Sub
  465. Private Sub chkUseTransP_Click()
  466.     nCIQ.UseTransparency = chkUseTransP.Value And 1
  467. End Sub
  468. Private Sub Form_Load()
  469.     Set nB = LoadResPicture("Backdrop", 0)
  470. End Sub
  471. Private Sub pTransLColorB_DblClick()
  472.     cDiaColor.Flags = cdlCCFullOpen + cdlCCRGBInit
  473.     cDiaColor.Color = pTransLColorB.BackColor
  474.     On Error Resume Next
  475.     cDiaColor.ShowColor
  476.     If Err = cdlCancel Then _
  477.         Exit Sub
  478.     pTransLColorB.BackColor = cDiaColor.Color
  479.     pTransLColorB.ToolTipText = mDCTC & "  &H" & Hex(pTransLColorB.BackColor)
  480. End Sub
  481. Private Sub pTransLColorP_Resize()
  482. pTransLColorB.Height = pTransLColorP.Height
  483. lPTransLColorB.Top = pTransLColorP.Height / 2 - lPTransLColorB.Height / 2
  484. End Sub
  485. Private Sub pTransPColorB_DblClick()
  486.     cDiaColor.Flags = cdlCCFullOpen + cdlCCRGBInit
  487.     cDiaColor.Color = pTransPColorB.BackColor
  488.     On Error Resume Next
  489.     cDiaColor.ShowColor
  490.     If Err = cdlCancel Then _
  491.         Exit Sub
  492.     pTransPColorB.BackColor = cDiaColor.Color
  493.     pImageView.BackColor = pTransPColorB.BackColor
  494.     pTransPColorB.ToolTipText = mDCTC & "  &H" & Hex(pTransPColorB.BackColor)
  495. End Sub
  496. Private Sub pTransPColorP_Resize()
  497. pTransPColorB.Height = pTransPColorP.Height
  498. lPTransPColorB.Top = pTransPColorP.Height / 2 - lPTransPColorB.Height / 2
  499. End Sub
  500. Private Sub tbView_ButtonClick(ByVal Button As MSComctlLib.Button)
  501.     On Error Resume Next
  502.     nView = Button.Key
  503. End Sub
  504. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  505.     cMSave
  506. End Sub
  507. Private Sub Form_Resize()
  508.     pImageView.Move pImageView.Left, pImageView.Top, pImageView.Width, ScaleHeight - cbTB.Height
  509.     pTransPColorP.Move tbGen.Buttons("TransPColorPH").Left, tbGen.Buttons("TransPColorPH").Top, tbGen.Buttons("TransPColorPH").Width, tbGen.Buttons("TransPColorPH").Height
  510.     pTransLColorP.Move tbGen.Buttons("TransLColorPH").Left, tbGen.Buttons("TransLColorPH").Top, tbGen.Buttons("TransLColorPH").Width, tbGen.Buttons("TransLColorPH").Height
  511.     pTranslLevelP.Move tbGen.Buttons("TransLLevelPH").Left, tbGen.Buttons("TransLLevelPH").Top, tbGen.Buttons("TransLLevelPH").Width, tbGen.Buttons("TransLLevelPH").Height
  512. End Sub
  513. Private Sub mnuFileExit_Click()
  514.     cExit
  515. End Sub
  516. Private Sub mnuFileOpen_Click()
  517.     cOpen
  518. End Sub
  519. Private Sub mnuFileSave_Click()
  520.     cSave
  521. End Sub
  522. Private Sub tbGen_ButtonClick(ByVal Button As MSComctlLib.Button)
  523.     pWork.Cls
  524.     On Error Resume Next
  525.     Select Case Button.Key
  526.         Case "Open"
  527.             cOpen
  528.         Case "Save"
  529.             cSave
  530.         Case "Compile"
  531.             MousePointer = vbHourglass
  532.             Dim m_lngLoopH As Long, m_lngLoopW As Long
  533.             pWSize = nCIQ.ImageStart
  534.             pWork.Move pWork.Left, pWork.Top, pWSize.Width, pWSize.Height
  535.             For m_lngLoopH = 0 To pWSize.Height
  536.                 For m_lngLoopW = 0 To pWSize.Width
  537.                     If nCIQ.UseTransparency Then
  538.                         If pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransPColorB.BackColor Then
  539.                             pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  540.                         Else
  541.                             pWork.PSet (m_lngLoopW, m_lngLoopH), 0
  542.                         End If
  543.                     Else
  544.                         If Not pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransLColorB.BackColor Then
  545.                             pWork.PSet (m_lngLoopW, m_lngLoopH), 0
  546.                         Else
  547.                             pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  548.                         End If
  549.                     End If
  550.                     If nCIQ.UseTranslucency Then
  551.                         If nCIQ.Style = [TransL!=Solid] Then
  552.                             If Not (Not pWSize.Point(m_lngLoopW, m_lngLoopH) = 0 And Not pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransLColorB.BackColor) Then
  553.                                 If Not pWSize.Point(m_lngLoopW, m_lngLoopH) = 0 Then
  554.                                     pWork.PSet (m_lngLoopW, m_lngLoopH), ReturnPercentageColor(pWSize.Point(m_lngLoopW, m_lngLoopH), 100 - txtTransLP)
  555.                                 Else
  556.                                     pWork.PSet (m_lngLoopW, m_lngLoopH), 0
  557.                                 End If
  558.                             End If
  559.                         Else
  560.                             If Not (pWSize.Point(m_lngLoopW, m_lngLoopH) = 0 Or pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransLColorB.BackColor) Then
  561.                                 'pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  562.                                 If pWSize.Point(m_lngLoopW, m_lngLoopH) = 0 And Not pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransPColorB.BackColor Then
  563.                                     pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(0)
  564.                                 Else
  565.                                     If pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransPColorB.BackColor Then
  566.                                         pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  567.                                     Else
  568.                                         pWork.PSet (m_lngLoopW, m_lngLoopH), ReturnPercentageColor(pWSize.Point(m_lngLoopW, m_lngLoopH), 100 - txtTransLP)
  569.                                     End If
  570.                                 End If
  571.                             End If
  572.                         End If
  573.                     End If
  574.                 Next
  575.             Next
  576.             Set nCIQ.ImageMask = pWork.Image
  577.             pWork.Cls
  578.             pWSize = nCIQ.ImageStart
  579.             For m_lngLoopH = 0 To pWSize.Height
  580.                 For m_lngLoopW = 0 To pWSize.Width
  581.                     If nCIQ.UseTransparency Then
  582.                         If pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransPColorB.BackColor Then
  583.                             pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  584.                         Else
  585.                             pWork.PSet (m_lngLoopW, m_lngLoopH), pWSize.Point(m_lngLoopW, m_lngLoopH)
  586.                         End If
  587.                     Else
  588.                         If Not pWSize.Point(m_lngLoopW, m_lngLoopH) = pTransLColorB.BackColor Then
  589.                             pWork.PSet (m_lngLoopW, m_lngLoopH), pWSize.Point(m_lngLoopW, m_lngLoopH)
  590.                         Else
  591.                             pWork.PSet (m_lngLoopW, m_lngLoopH), QBColor(15)
  592.                         End If
  593.                     End If
  594.                 Next
  595.             Next
  596.             Set nCIQ.ImageCompiled = pWork.Image
  597.             '
  598.             '
  599.             Compiled = True
  600.             Changed = True
  601.     End Select
  602.     MousePointer = 0
  603. End Sub
  604. Public Sub cSave()
  605.     If Not Changed Then _
  606.         Exit Sub
  607.     If Len(nFileName) = 0 Then Exit Sub
  608.     On Error Resume Next
  609.     cDia.Flags = 4 + cdlOFNOverwritePrompt
  610.     cDia.DialogTitle = "Select the Compiled Image Filename"
  611.     cDia.FileName = "image.bmp"
  612.     cDia.ShowSave
  613.     If Err = cdlCancel Then _
  614.         Exit Sub
  615.     SavePicture nCIQ.ImageCompiled, cDia.FileName
  616.     If nCIQ.UseTransparency Then
  617.     cDia.DialogTitle = "Select the Image Mask Filename"
  618.     cDia.FileName = "mask.bmp"
  619.     cDia.ShowSave
  620.     If Err = cdlCancel Then _
  621.         Exit Sub
  622.     SavePicture nCIQ.ImageMask, cDia.FileName
  623.     End If
  624.     Changed = False
  625. End Sub
  626. Public Sub cOpen()
  627.     cMSave
  628.     On Error Resume Next
  629.     cDia.DialogTitle = "Select the Image to Open"
  630.     cDia.Flags = 4 + cdlOFNFileMustExist
  631.     cDia.ShowOpen
  632.     If Err = cdlCancel Then _
  633.         Exit Sub
  634.     nFileName = cDia.FileName
  635.     Set nCIQ = New CImgQuad
  636.     chkUseTransL.Value = nCIQ.UseTranslucency And 1
  637.     chkUseTransP.Value = nCIQ.UseTransparency And 1
  638.     cboStyle.ListIndex = nCIQ.Style
  639.     Set nCIQ.ImageStart = LoadPicture(nFileName)
  640.     Changed = False
  641. End Sub
  642. Public Sub cMSave()
  643.     If Changed Then
  644.         If MsgBox("Do you wish to save changes to your compiled images?", vbYesNo + vbQuestion, App.Title & " - Question") = vbYes Then
  645.             cSave
  646.         End If
  647.             If Quitting Then _
  648.                 Changed = False
  649.     End If
  650. End Sub
  651. Public Sub cExit()
  652.     Quitting = True
  653.     cMSave
  654.     Unload Me
  655. End Sub
  656. Private Sub tEnableCheck_Timer()
  657.     Dim nButton As Button
  658.     Set nButton = tbGen.Buttons("Compile")
  659.     IfNotThenEnable nButton, (nButton.Enabled = CBool(Not Len(nFileName) = 0))
  660.     For Each nButton In tbView.Buttons
  661.         IfNotThenEnable nButton, (nButton.Enabled = CBool((Not Len(nFileName) = 0) And Compiled))
  662.     Next
  663.     If Not Compiled Then _
  664.         Exit Sub
  665.     UpdateImage
  666. End Sub
  667. Public Sub IfNotThenEnable(Object As Object, Value As Boolean)
  668.     If Not Value Then _
  669.         Object.Enabled = True
  670. End Sub
  671. Public Sub UpdateImage()
  672.     If nCIQ Is Nothing Then _
  673.         Compiled = False: _
  674.         Exit Sub
  675.     If Not Compiled Then Exit Sub
  676.     pImageView.Cls
  677.     On Error Resume Next
  678.     Select Case nView
  679.         Case "Starting Image"
  680.             pWSize.Picture = nCIQ.ImageStart
  681.             pImageView.PaintPicture nCIQ.ImageStart, pImageView.ScaleWidth / 2 - pWSize.Width / 2, pImageView.ScaleHeight / 2 - pWSize.ScaleHeight / 2
  682.         Case "Compiled Image"
  683.             pWSize.Picture = nCIQ.ImageStart
  684.             pImageView.PaintPicture nCIQ.ImageCompiled, pImageView.ScaleWidth / 2 - pWSize.Width / 2, pImageView.ScaleHeight / 2 - pWSize.ScaleHeight / 2
  685.         Case "Mask"
  686.             pWSize.Picture = nCIQ.ImageStart
  687.             pImageView.PaintPicture nCIQ.ImageMask, pImageView.ScaleWidth / 2 - pWSize.Width / 2, pImageView.ScaleHeight / 2 - pWSize.ScaleHeight / 2
  688.         Case "Put-together Image"
  689.             Dim nWid As Integer
  690.             nWid = pImageView.ScaleWidth / 16
  691.             Dim m_lngLoop As Long
  692.             pWSize.Picture = nB
  693.             TileImage pImageView, pWSize
  694.             pWSize.Picture = nCIQ.ImageStart
  695.             pImageView.Line (0, 0)-(pWSize.Width * 2, pWSize.Height * 2), QBColor(2), BF
  696.             pImageView.PaintPicture nCIQ.ImageMask, 0, 0, , , , , , , vbMergePaint
  697.             pImageView.PaintPicture nCIQ.ImageCompiled, pWSize.Width, 0, , , , , , , vbSrcAnd
  698.             
  699.             pImageView.PaintPicture nCIQ.ImageMask, 0, pWSize.Height
  700.             pImageView.PaintPicture nCIQ.ImageCompiled, pWSize.Width, pWSize.Height
  701.             
  702.             pWSize.Picture = nCIQ.ImageStart
  703.             pImageView.PaintPicture nCIQ.ImageMask, pImageView.ScaleWidth / 2 - pWSize.Width / 2, pImageView.ScaleHeight / 2 - pWSize.ScaleHeight / 2, , , , , , , vbMergePaint
  704.             pWSize.Picture = nCIQ.ImageStart
  705.             pImageView.PaintPicture nCIQ.ImageCompiled, pImageView.ScaleWidth / 2 - pWSize.Width / 2, pImageView.ScaleHeight / 2 - pWSize.ScaleHeight / 2, , , , , , , vbSrcAnd
  706.     End Select
  707. End Sub
  708. Public Function ReturnPercentageColor(Color As OLE_COLOR, Percent As Byte) As OLE_COLOR
  709.     Dim R As Byte, G As Byte, B As Byte
  710.     R = (CLng((Color Mod 256) * Percent)) \ 100
  711.     G = (CLng((Color \ 256 Mod 256) * Percent)) \ 100
  712.     B = (CLng((Color \ 256 \ 256 Mod 256) * Percent)) \ 100
  713.     ReturnPercentageColor = RGB(R, G, B)
  714. End Function
  715.