home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / olympus / ik32_15t / vb4.shr / Optim.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-04  |  8.7 KB  |  277 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Optimize Palette"
  5.    ClientHeight    =   3735
  6.    ClientLeft      =   1425
  7.    ClientTop       =   2190
  8.    ClientWidth     =   8415
  9.    Height          =   4425
  10.    Left            =   1365
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3735
  16.    ScaleWidth      =   8415
  17.    Top             =   1560
  18.    Width           =   8535
  19.    Begin VB.CommandButton cmdDitherSrc2 
  20.       Caption         =   "D&ither Palette to Destination"
  21.       Height          =   375
  22.       Left            =   2880
  23.       TabIndex        =   9
  24.       Top             =   2760
  25.       Width           =   2655
  26.    End
  27.    Begin VB.CommandButton cmdDitherSrc1 
  28.       Caption         =   "&Dither Palette to Destination"
  29.       Height          =   375
  30.       Left            =   120
  31.       TabIndex        =   8
  32.       Top             =   2760
  33.       Width           =   2655
  34.    End
  35.    Begin VB.CommandButton cmdRemapSrc1 
  36.       Caption         =   "&Remap Palette to Destination"
  37.       Height          =   375
  38.       Left            =   120
  39.       TabIndex        =   4
  40.       Top             =   3240
  41.       Width           =   2655
  42.    End
  43.    Begin VB.CommandButton cmdRemapSrc2 
  44.       Caption         =   "R&emap Palette to Destination"
  45.       Height          =   375
  46.       Left            =   2880
  47.       TabIndex        =   3
  48.       Top             =   3240
  49.       Width           =   2655
  50.    End
  51.    Begin VB.TextBox txtNumColors 
  52.       Height          =   285
  53.       Left            =   7680
  54.       TabIndex        =   1
  55.       Text            =   "256"
  56.       Top             =   3360
  57.       Width           =   615
  58.    End
  59.    Begin VB.CommandButton cmdOptimize 
  60.       Caption         =   "&Optimize Palette"
  61.       Height          =   375
  62.       Left            =   5640
  63.       TabIndex        =   0
  64.       Top             =   2760
  65.       Width           =   2655
  66.    End
  67.    Begin ik32Lib.Picbuf PicbufDest 
  68.       Height          =   2415
  69.       Left            =   5640
  70.       TabIndex        =   12
  71.       Top             =   240
  72.       Width           =   2655
  73.       _Version        =   65541
  74.       _ExtentX        =   4683
  75.       _ExtentY        =   4260
  76.       _StockProps     =   253
  77.    End
  78.    Begin ik32Lib.Picbuf PicbufSrc2 
  79.       Height          =   2415
  80.       Left            =   2880
  81.       TabIndex        =   11
  82.       Top             =   240
  83.       Width           =   2655
  84.       _Version        =   65541
  85.       _ExtentX        =   4683
  86.       _ExtentY        =   4260
  87.       _StockProps     =   253
  88.    End
  89.    Begin ik32Lib.Picbuf PicbufSrc1 
  90.       Height          =   2415
  91.       Left            =   120
  92.       TabIndex        =   10
  93.       Top             =   240
  94.       Width           =   2655
  95.       _Version        =   65541
  96.       _ExtentX        =   4683
  97.       _ExtentY        =   4260
  98.       _StockProps     =   253
  99.    End
  100.    Begin VB.PictureBox CommonDialog1 
  101.       Height          =   480
  102.       Left            =   360
  103.       ScaleHeight     =   420
  104.       ScaleWidth      =   1140
  105.       TabIndex        =   13
  106.       Top             =   840
  107.       Width           =   1200
  108.    End
  109.    Begin VB.Label Label4 
  110.       Caption         =   "Destination Picbuf"
  111.       Height          =   255
  112.       Left            =   5640
  113.       TabIndex        =   7
  114.       Top             =   0
  115.       Width           =   2655
  116.    End
  117.    Begin VB.Label Label3 
  118.       Caption         =   "Source 2 Picbuf"
  119.       Height          =   255
  120.       Left            =   2880
  121.       TabIndex        =   6
  122.       Top             =   0
  123.       Width           =   2655
  124.    End
  125.    Begin VB.Label Label2 
  126.       Caption         =   "Source 1 Picbuf"
  127.       Height          =   255
  128.       Left            =   120
  129.       TabIndex        =   5
  130.       Top             =   0
  131.       Width           =   2655
  132.    End
  133.    Begin VB.Label Label1 
  134.       Caption         =   "Number of Colors:"
  135.       Height          =   255
  136.       Left            =   5640
  137.       TabIndex        =   2
  138.       Top             =   3360
  139.       Width           =   1695
  140.    End
  141.    Begin VB.Menu mnuFile 
  142.       Caption         =   "&File"
  143.       Begin VB.Menu mnuLoadSrc1 
  144.          Caption         =   "&Load Source 1 Image..."
  145.       End
  146.       Begin VB.Menu mnuLoadSrc2 
  147.          Caption         =   "Load &Source 2 Image..."
  148.       End
  149.       Begin VB.Menu mnuLoadDest 
  150.          Caption         =   "Load &Destination Image..."
  151.       End
  152.       Begin VB.Menu mnuSaveSrc1 
  153.          Caption         =   "&Save Source 1 Image..."
  154.       End
  155.       Begin VB.Menu mnuSaveSrc2 
  156.          Caption         =   "Save S&ource 2 Image..."
  157.       End
  158.       Begin VB.Menu mnuSaveDest 
  159.          Caption         =   "Save D&estination Image..."
  160.       End
  161.       Begin VB.Menu mnuSpacer 
  162.          Caption         =   "-"
  163.       End
  164.       Begin VB.Menu mnuExit 
  165.          Caption         =   "E&xit"
  166.       End
  167.    End
  168.    Begin VB.Menu mnuReload 
  169.       Caption         =   "&Reload"
  170.    End
  171. Attribute VB_Name = "Form1"
  172. Attribute VB_Creatable = False
  173. Attribute VB_Exposed = False
  174. Option Explicit
  175. 'Description: This code dithers the image in Source1
  176. 'to the palette of the destination image.
  177. Private Sub cmdDitherSrc1_Click()
  178.     PicbufSrc1.DitherPal PicbufDest
  179. End Sub
  180. 'Description: This code dithers the image in Source2
  181. 'to the palette of the destination image.
  182. Private Sub cmdDitherSrc2_Click()
  183.     PicbufSrc2.DitherPal PicbufDest
  184. End Sub
  185. 'Description: Here we create an object array, and
  186. 'pass it to the OptimizePal method to optimize the
  187. 'destination image to the colors of sources 1 & 2
  188. Private Sub cmdOptimize_Click()
  189.     Dim ImageArray(0 To 1) As Object
  190.     Set ImageArray(0) = PicbufSrc1
  191.     Set ImageArray(1) = PicbufSrc2
  192.     Call PicbufDest.OptimizePal(ImageArray, 2, Val(txtNumColors.Text))
  193. End Sub
  194. 'Description: This code remaps the image in Source1
  195. 'to the palette of the destination image.
  196. Private Sub cmdRemapSrc1_Click()
  197.     PicbufSrc1.RemapPal PicbufDest
  198. End Sub
  199. 'Description: This code remaps the image in Source2
  200. 'to the palette of the destination image.
  201. Private Sub cmdRemapSrc2_Click()
  202.     PicbufSrc2.RemapPal PicbufDest
  203. End Sub
  204. 'Description: This code sets all of the picbuf
  205. 'properties
  206. Private Sub Form_Load()
  207.     'Set picbuf properties
  208.     InitPicbuf PicbufSrc1, True, "marybeth.tif"
  209.     InitPicbuf PicbufSrc2, True, "leaves8.pcx"
  210.     InitPicbuf PicbufDest, True, "winlogo1.bmp"
  211. End Sub
  212. 'Description: This code exits the program
  213. Private Sub ikExit_Click()
  214. End Sub
  215. 'Description: This code uses the Common Dialog
  216. 'control to select a file name, and then loads it
  217. 'into the picbuf
  218. Private Sub ikLoadDest_Click()
  219. 'use sub routine to get image filename
  220. Call LoadImage(PicbufDest, CommonDialog1)
  221. End Sub
  222. 'Description: This code uses the Common Dialog
  223. 'control to select a file name, and then loads it
  224. 'into the picbuf
  225. Private Sub ikLoadSrc1_Click()
  226. 'use sub routine to get image filename
  227. Call LoadImage(PicbufSrc1, CommonDialog1)
  228. End Sub
  229. 'Description: This code uses the Common Dialog
  230. 'control to select a file name, and then loads it
  231. 'into the picbuf
  232. Private Sub ikLoadSrc2_Click()
  233. 'use sub routine to get image filename
  234. Call LoadImage(PicbufSrc2, CommonDialog1)
  235. End Sub
  236. 'Description: This code ends the program.
  237. Private Sub mnuExit_Click()
  238.     ExitProgram
  239. End Sub
  240. 'Description: This code loads an image into a
  241. 'picbuf using the common dialog control.
  242. Private Sub mnuLoadDest_Click()
  243.     LoadImage PicbufDest, CommonDialog1
  244. End Sub
  245. 'Description: This code loads an image into a
  246. 'picbuf using the common dialog control.
  247. Private Sub mnuLoadSrc1_Click()
  248.     LoadImage PicbufSrc1, CommonDialog1
  249. End Sub
  250. 'Description: This code loads an image into a
  251. 'picbuf using the common dialog control.
  252. Private Sub mnuLoadSrc2_Click()
  253.     LoadImage PicbufSrc2, CommonDialog1
  254. End Sub
  255. 'Description: To reload, we simply invoke the
  256. 'load command for all three picbufs again.
  257. Private Sub mnuReload_Click()
  258.     PicbufSrc1.Load
  259.     PicbufSrc2.Load
  260.     PicbufDest.Load
  261. End Sub
  262. 'Description: This code saves an image from a
  263. 'picbuf using the common dialog control.
  264. Private Sub mnuSaveDest_Click()
  265.     SaveImage PicbufDest, CommonDialog1
  266. End Sub
  267. 'Description: This code saves an image from a
  268. 'picbuf using the common dialog control.
  269. Private Sub mnuSaveSrc1_Click()
  270.     SaveImage PicbufSrc1, CommonDialog1
  271. End Sub
  272. 'Description: This code saves an image from a
  273. 'picbuf using the common dialog control.
  274. Private Sub mnuSaveSrc2_Click()
  275.     SaveImage PicbufSrc2, CommonDialog1
  276. End Sub
  277.