Results 1 to 7 of 7

Thread: [VB6] - the Graphics Class

Threaded View

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    [VB6] - the Graphics Class

    heres my class on attachments files...
    heres how use it:
    Code:
    Set ImageData = New Graphics
        ImageData.GetImageData Picture2
        ImageData.BackColor = vbYellow
        ImageData.Rotate = 45
        ImageData.Mirror = HorizontalVertical
        
        ImageData.DrawImageData Picture1, 40, 40
        Set ImageData = Nothing
    i have 2 errors:
    1 - the BackColor isn't changed and i don't see why
    Code:
    'change image backcolor
                If ImageDataChanged(X + 2, Y) <> clrBackColor.Red And ImageDataChanged(X + 1, Y) <> clrBackColor.Green And ImageDataChanged(X, Y) <> clrBackColor.Blue Then
                    ImageDataChanged(X + 2, Y) = clrBackColor.Red
                    ImageDataChanged(X + 1, Y) = clrBackColor.Green
                    ImageDataChanged(X, Y) = clrBackColor.Blue
                End If
    2 - by some reason the rotation values\results aren't corrected
    Code:
    For X = 0 To ByteAlignOnWord(bmi.bmHeader.bmBitCount, lngWidthImage) - 3 Step 3
            For Y = 0 To lngHeigthImage - 1
                'Rotate an image
                If lngRotate <> 0 Then
                    RC = InvRotateCoord(X, Y, lngWidthImage / 2, lngHeigthImage / 2, lngRotate)
                    If RC.RotatedX <= 0 Or RC.RotatedX >= bm.bmWidth Or RC.RotatedY <= 0 Or RC.RotatedY >= bm.bmHeight Then
                        'do nothing
                    Else
                        ImageDataChanged(X + 2, Y) = ImageData(RC.RotatedX + 2, RC.RotatedY)
                        ImageDataChanged(X + 1, Y) = ImageData(RC.RotatedX + 1, RC.RotatedY)
                        ImageDataChanged(X, Y) = ImageData(RC.RotatedX, RC.RotatedY)
                        If RGB(ImageDataChanged(X + 2, Y), ImageDataChanged(X + 1, Y), ImageDataChanged(X, Y)) = &HFFFF Or X >= bm.bmWidth Or Y >= bm.bmHeight Then
                            ImageDataChanged(X + 2, Y) = clrOldBackColor.Red
                            ImageDataChanged(X + 1, Y) = clrOldBackColor.Green
                            ImageDataChanged(X, Y) = clrOldBackColor.Blue
                        End If
                    End If
                Else
                    ImageDataChanged(X + 2, Y) = ImageData(X + 2, Y)
                    ImageDataChanged(X + 1, Y) = ImageData(X + 1, Y)
                    ImageDataChanged(X, Y) = ImageData(X, Y)
                End If
    ca anyone advice me?
    Attached Files Attached Files
    VB6 2D Sprite control

    To live is difficult, but we do it.

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