Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

copy bitmap over second bitmap

Posted on 2003-03-29
5
Medium Priority
?
273 Views
Last Modified: 2010-05-01
I have a problem. I want to copy a bitmap over second bitmap and then save that bitmap as third bitmap.If anybody knows this solution pleasehelp.

0
Comment
Question by:malik_mumtaz
5 Comments
 
LVL 1

Accepted Solution

by:
foxyshadis earned 336 total points
ID: 8231819
Are you looking for something like this?

pctGraph3.Cls
pctGraph3.PaintPicture pctGraph1.Image, startX1, startY1
pctGraph3.PaintPicture pctGraph2.Image, startX2, startY2

That clears the third, then layers the first and second onto it. If you need to save it to disk, you then use:

SavePicture pctGraph3.Picture, Path & Name & ".bmp"
0
 
LVL 2

Assisted Solution

by:JoaTex
JoaTex earned 332 total points
ID: 8232825
Hi

Try This Little Program:

Put in a form
3 CommonButtons
3 Picture Box

Name command1 = cmdBlend
Name Command2 = cmdReset
Name Command3 = cmdSave
Name Picture1 = Picsrc1
Name Picture2 = Picsrc2
Name Picture3 = PicDest
Set All Picture to:
ScaleMode = 3-Pixel
Set PicDest to:
AutoRedraw = True

Now put 1 Picture on  on Picsrc1 and other on Picsrc2 (can be any kind of picture or Graphic)

Run the Code,Click Blend and Save it.

Code:

Option Explicit

    Private Function Blend( _
          ByVal Color1 As Long, _
          ByVal Color2 As Long) As Long

          Dim r As Long, g As Long, b As Long

          b = ((((Color2 \ &H10000) And &HFF) * 50) + _
               (((Color1 \ &H10000) And &HFF) * 50)) \ 100

          g = ((((Color2 \ &H100) And &HFF) * 50) + _
               (((Color1 \ &H100) And &HFF) * 50)) \ 100

          r = (((Color2 And &HFF) * 50) + _
               ((Color1 And &HFF) * 50)) \ 100

          Blend = RGB(r, g, b)
     End Function

     Private Sub cmdBlend_Click()
          Dim x As Long
          Dim y As Long

          For y = 0 To Picsrc1.ScaleHeight
               For x = 0 To Picsrc1.ScaleWidth
                    PicDest.PSet (x, y), Blend(Picsrc1.Point(x, y), Picsrc2.Point(x, y))
               Next
          Next
     End Sub

Private Sub CmdSave_Click()
   SavePicture PicDest.Image, App.Path & "\Teste.bmp"
End Sub

Private Sub Command1_Click()
          Dim x As Long
          Dim y As Long

          For y = 0 To Picsrc1.ScaleHeight
               For x = 0 To Picsrc1.ScaleWidth
                    PicDest.PSet (x, y), Point(x, y)
               Next
          Next
End Sub

Hope it suites You
Jo
0
 
LVL 55

Assisted Solution

by:Ryan Chong
Ryan Chong earned 332 total points
ID: 8233194
Optionally, try explore the StretchBlt and BitBlt API.

Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long


Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
0
 

Expert Comment

by:CleanupPing
ID: 8531364
Hi malik_mumtaz,
This old question (QID 20567393) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9440721
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Split between foxyshadis and JoaTex and ryancys

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question