home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Optimize Palette"
- ClientHeight = 3735
- ClientLeft = 1425
- ClientTop = 2190
- ClientWidth = 8415
- Height = 4425
- Left = 1365
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3735
- ScaleWidth = 8415
- Top = 1560
- Width = 8535
- Begin VB.CommandButton cmdDitherSrc2
- Caption = "D&ither Palette to Destination"
- Height = 375
- Left = 2880
- TabIndex = 9
- Top = 2760
- Width = 2655
- End
- Begin VB.CommandButton cmdDitherSrc1
- Caption = "&Dither Palette to Destination"
- Height = 375
- Left = 120
- TabIndex = 8
- Top = 2760
- Width = 2655
- End
- Begin VB.CommandButton cmdRemapSrc1
- Caption = "&Remap Palette to Destination"
- Height = 375
- Left = 120
- TabIndex = 4
- Top = 3240
- Width = 2655
- End
- Begin VB.CommandButton cmdRemapSrc2
- Caption = "R&emap Palette to Destination"
- Height = 375
- Left = 2880
- TabIndex = 3
- Top = 3240
- Width = 2655
- End
- Begin VB.TextBox txtNumColors
- Height = 285
- Left = 7680
- TabIndex = 1
- Text = "256"
- Top = 3360
- Width = 615
- End
- Begin VB.CommandButton cmdOptimize
- Caption = "&Optimize Palette"
- Height = 375
- Left = 5640
- TabIndex = 0
- Top = 2760
- Width = 2655
- End
- Begin ik32Lib.Picbuf PicbufDest
- Height = 2415
- Left = 5640
- TabIndex = 12
- Top = 240
- Width = 2655
- _Version = 65541
- _ExtentX = 4683
- _ExtentY = 4260
- _StockProps = 253
- End
- Begin ik32Lib.Picbuf PicbufSrc2
- Height = 2415
- Left = 2880
- TabIndex = 11
- Top = 240
- Width = 2655
- _Version = 65541
- _ExtentX = 4683
- _ExtentY = 4260
- _StockProps = 253
- End
- Begin ik32Lib.Picbuf PicbufSrc1
- Height = 2415
- Left = 120
- TabIndex = 10
- Top = 240
- Width = 2655
- _Version = 65541
- _ExtentX = 4683
- _ExtentY = 4260
- _StockProps = 253
- End
- Begin VB.PictureBox CommonDialog1
- Height = 480
- Left = 360
- ScaleHeight = 420
- ScaleWidth = 1140
- TabIndex = 13
- Top = 840
- Width = 1200
- End
- Begin VB.Label Label4
- Caption = "Destination Picbuf"
- Height = 255
- Left = 5640
- TabIndex = 7
- Top = 0
- Width = 2655
- End
- Begin VB.Label Label3
- Caption = "Source 2 Picbuf"
- Height = 255
- Left = 2880
- TabIndex = 6
- Top = 0
- Width = 2655
- End
- Begin VB.Label Label2
- Caption = "Source 1 Picbuf"
- Height = 255
- Left = 120
- TabIndex = 5
- Top = 0
- Width = 2655
- End
- Begin VB.Label Label1
- Caption = "Number of Colors:"
- Height = 255
- Left = 5640
- TabIndex = 2
- Top = 3360
- Width = 1695
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuLoadSrc1
- Caption = "&Load Source 1 Image..."
- End
- Begin VB.Menu mnuLoadSrc2
- Caption = "Load &Source 2 Image..."
- End
- Begin VB.Menu mnuLoadDest
- Caption = "Load &Destination Image..."
- End
- Begin VB.Menu mnuSaveSrc1
- Caption = "&Save Source 1 Image..."
- End
- Begin VB.Menu mnuSaveSrc2
- Caption = "Save S&ource 2 Image..."
- End
- Begin VB.Menu mnuSaveDest
- Caption = "Save D&estination Image..."
- End
- Begin VB.Menu mnuSpacer
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- End
- End
- Begin VB.Menu mnuReload
- Caption = "&Reload"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- 'Description: This code dithers the image in Source1
- 'to the palette of the destination image.
- Private Sub cmdDitherSrc1_Click()
- PicbufSrc1.DitherPal PicbufDest
- End Sub
- 'Description: This code dithers the image in Source2
- 'to the palette of the destination image.
- Private Sub cmdDitherSrc2_Click()
- PicbufSrc2.DitherPal PicbufDest
- End Sub
- 'Description: Here we create an object array, and
- 'pass it to the OptimizePal method to optimize the
- 'destination image to the colors of sources 1 & 2
- Private Sub cmdOptimize_Click()
- Dim ImageArray(0 To 1) As Object
- Set ImageArray(0) = PicbufSrc1
- Set ImageArray(1) = PicbufSrc2
- Call PicbufDest.OptimizePal(ImageArray, 2, Val(txtNumColors.Text))
- End Sub
- 'Description: This code remaps the image in Source1
- 'to the palette of the destination image.
- Private Sub cmdRemapSrc1_Click()
- PicbufSrc1.RemapPal PicbufDest
- End Sub
- 'Description: This code remaps the image in Source2
- 'to the palette of the destination image.
- Private Sub cmdRemapSrc2_Click()
- PicbufSrc2.RemapPal PicbufDest
- End Sub
- 'Description: This code sets all of the picbuf
- 'properties
- Private Sub Form_Load()
- 'Set picbuf properties
- InitPicbuf PicbufSrc1, True, "marybeth.tif"
- InitPicbuf PicbufSrc2, True, "leaves8.pcx"
- InitPicbuf PicbufDest, True, "winlogo1.bmp"
- End Sub
- 'Description: This code exits the program
- Private Sub ikExit_Click()
- End Sub
- 'Description: This code uses the Common Dialog
- 'control to select a file name, and then loads it
- 'into the picbuf
- Private Sub ikLoadDest_Click()
- 'use sub routine to get image filename
- Call LoadImage(PicbufDest, CommonDialog1)
- End Sub
- 'Description: This code uses the Common Dialog
- 'control to select a file name, and then loads it
- 'into the picbuf
- Private Sub ikLoadSrc1_Click()
- 'use sub routine to get image filename
- Call LoadImage(PicbufSrc1, CommonDialog1)
- End Sub
- 'Description: This code uses the Common Dialog
- 'control to select a file name, and then loads it
- 'into the picbuf
- Private Sub ikLoadSrc2_Click()
- 'use sub routine to get image filename
- Call LoadImage(PicbufSrc2, CommonDialog1)
- End Sub
- 'Description: This code ends the program.
- Private Sub mnuExit_Click()
- ExitProgram
- End Sub
- 'Description: This code loads an image into a
- 'picbuf using the common dialog control.
- Private Sub mnuLoadDest_Click()
- LoadImage PicbufDest, CommonDialog1
- End Sub
- 'Description: This code loads an image into a
- 'picbuf using the common dialog control.
- Private Sub mnuLoadSrc1_Click()
- LoadImage PicbufSrc1, CommonDialog1
- End Sub
- 'Description: This code loads an image into a
- 'picbuf using the common dialog control.
- Private Sub mnuLoadSrc2_Click()
- LoadImage PicbufSrc2, CommonDialog1
- End Sub
- 'Description: To reload, we simply invoke the
- 'load command for all three picbufs again.
- Private Sub mnuReload_Click()
- PicbufSrc1.Load
- PicbufSrc2.Load
- PicbufDest.Load
- End Sub
- 'Description: This code saves an image from a
- 'picbuf using the common dialog control.
- Private Sub mnuSaveDest_Click()
- SaveImage PicbufDest, CommonDialog1
- End Sub
- 'Description: This code saves an image from a
- 'picbuf using the common dialog control.
- Private Sub mnuSaveSrc1_Click()
- SaveImage PicbufSrc1, CommonDialog1
- End Sub
- 'Description: This code saves an image from a
- 'picbuf using the common dialog control.
- Private Sub mnuSaveSrc2_Click()
- SaveImage PicbufSrc2, CommonDialog1
- End Sub
-