Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - renner96

Pages: [1]
1
DotNet / [UPDATED] convert graphics.image to sfml.graphics.image
« on: July 31, 2009, 10:18:57 pm »
Can somebody change the following code that it could be used with sfml directly


Code: [Select]
   Private Shared Function RotateImageByAngle(ByVal oldBitmap As System.Drawing.Image, ByVal angle As Single) As Bitmap
        Dim newBitmap As Bitmap
        Dim graphics1 As Graphics
        If oldBitmap.Width >= oldBitmap.Height Then
            newBitmap = New Bitmap(oldBitmap.Width * 2, oldBitmap.Width * 2)
        Else
            newBitmap = New Bitmap(oldBitmap.Height * 2, oldBitmap.Height * 2)
        End If
        graphics1 = Graphics.FromImage(newBitmap)
        graphics1.TranslateTransform(CSng(oldBitmap.Width) / 2, CSng(oldBitmap.Height) / 2)
        graphics1.RotateTransform(angle)
        graphics1.TranslateTransform(-CSng(oldBitmap.Width) / 2, -CSng(oldBitmap.Height) / 2)
        graphics1.DrawImage(oldBitmap, New Point(0, 0))
        Return newBitmap
    End Function


PS: the code is the reason, why i wanted to change the image into sfml

2
DotNet / How can I convert SFML.Graphics.Image to System.Drawing.Imag
« on: July 31, 2009, 09:11:44 pm »
Is there a way to do the opposite???

(see my other post: http://www.sfml-dev.org/forum/viewtopic.php?p=9436#9436)

3
DotNet / [UPDATED] convert graphics.image to sfml.graphics.image
« on: July 31, 2009, 09:05:14 pm »
Hi,
i want to convert a graphics.image, wich I converted with the following code to a byte array , into a SFML.Graphics.Image.
Code: [Select]

Public Function imageToByteArray(ByVal imageIn As System.Drawing.Image) As Byte()
    Dim ms As MemoryStream = New MemoryStream()
    imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif)
    Return ms.ToArray()
End Function

I hope you can help me. Can i do it without the array?
Thank You
renner96

PS: My English isnĀ“t very good. I`m only on the 7th grade on a German grammar school.


//edit: i tried it with a memorystream, too, but i got an exeption: Failed to load image from memory

//edit2: is there a function to make the image of an graphics.bitmap???

Pages: [1]