Hi
I am trying to save a part of a bitmap, but I cant get it right.
The following program almost does it, but there is one BIG problem.
The part of the image, that I am saving, should be 96dip x 64dip. That small part does get saved, but it gets filled with black around it and the bitmap ends up with 480x465.
Can someone tell me what is wrong?
canvas1.Initialize(Panel1)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "1.jpg")
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip, 96dip, 64dip)
Dim name As String
Dim Out As OutputStream
Dim SrcRect As Rect
Dim Nummer As Int
SrcRect.Initialize(0, 0, 96, 64)
DestRect.Top = 0dip
DestRect.Bottom = 64dip
DestRect.Left = 0dip
DestRect.Right = 96dip
canvas1.DrawBitmap(Bitmap1, SrcRect, DestRect)
name="part1.png"
Out = File.OpenOutput(File.DirRootExternal, name, False)
canvas1.Bitmap.WriteToStream(Out, 100, "PNG")
Out.Close
Kind regards
Jakob
I am trying to save a part of a bitmap, but I cant get it right.
The following program almost does it, but there is one BIG problem.
The part of the image, that I am saving, should be 96dip x 64dip. That small part does get saved, but it gets filled with black around it and the bitmap ends up with 480x465.
Can someone tell me what is wrong?
canvas1.Initialize(Panel1)
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "1.jpg")
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip, 96dip, 64dip)
Dim name As String
Dim Out As OutputStream
Dim SrcRect As Rect
Dim Nummer As Int
SrcRect.Initialize(0, 0, 96, 64)
DestRect.Top = 0dip
DestRect.Bottom = 64dip
DestRect.Left = 0dip
DestRect.Right = 96dip
canvas1.DrawBitmap(Bitmap1, SrcRect, DestRect)
name="part1.png"
Out = File.OpenOutput(File.DirRootExternal, name, False)
canvas1.Bitmap.WriteToStream(Out, 100, "PNG")
Out.Close
Kind regards
Jakob