Results 1 to 6 of 6

Thread: [RESOLVED] Mirror Image?

  1. #1

    Thread Starter
    Hyperactive Member half flung pie's Avatar
    Join Date
    Jun 2005
    Location
    South Carolina, USA
    Posts
    317

    Resolved [RESOLVED] Mirror Image?

    Does anyone know of a way I can mirror an image (from a PictureBox control) and send it to my form, similar to bitblt, only mirroring it also. The process needs to be fast, as I have to do the operation a few times per second. (The image is a sprite) I've searched google and the forums and got nothing.

    Base 2
    Fcnncu"Nqxgu"Lguug##

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Mirror Image?

    Try this:
    VB Code:
    1. 'original Picturebox is on Form1 and we will copy it to Form2
    2. Private Sub Command1_Click()
    3.     'assuming Form2 is already loaded and showing - otherwise Show it
    4.     With Form2.Picture1
    5.         .AutoRedraw = True
    6.         .Width = Picture1.Width
    7.         .Height = Picture1.Height
    8.         .PaintPicture Picture1.Picture, _
    9.                       Picture1.ScaleWidth, 0, _
    10.                       -Picture1.ScaleWidth, Picture1.ScaleHeight
    11.         .Picture = .Image
    12.         .Refresh
    13.     End With
    14. End Sub

  3. #3

    Thread Starter
    Hyperactive Member half flung pie's Avatar
    Join Date
    Jun 2005
    Location
    South Carolina, USA
    Posts
    317

    Re: Mirror Image?

    Hrm... well, sorry about this, but I just realized that I need to keep the image where it is.
    For example,
    an image is in picbox.
    I run whatever code.
    The image is still in picbox, only mirrored (left to right, if that matters)

    Base 2
    Fcnncu"Nqxgu"Lguug##

  4. #4

    Thread Starter
    Hyperactive Member half flung pie's Avatar
    Join Date
    Jun 2005
    Location
    South Carolina, USA
    Posts
    317

    Re: Mirror Image?

    From what I've been able to dig up on Google, this can be done using StretchBlt, but I can't find how.

    Base 2
    Fcnncu"Nqxgu"Lguug##

  5. #5

    Thread Starter
    Hyperactive Member half flung pie's Avatar
    Join Date
    Jun 2005
    Location
    South Carolina, USA
    Posts
    317

    Re: Mirror Image?

    I got it to work!!!
    VB Code:
    1. If .Reversed Then StretchBlt picCurrentSprite.hdc, .Width - 1, 0, -.Width, .Height, .hDC_of_src_Pic, .xSrc, .ySrc, .Width, .Height, vbSrcCopy
    2.    If Not .Reversed Then BitBlt picCurrentSprite.hdc, 0, 0, .Width, .Height, .hDC_of_src_Pic, .xSrc, .ySrc, vbSrcCopy

    Base 2
    Fcnncu"Nqxgu"Lguug##

  6. #6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width