Creating (and "deleting") too many bitmaps seems to be a bit of a problem if the garbage collector is not running very often compared with the bitmap creation rate.
As an example - GaussianBlurring a bitmap as a slider specifying the blur radius is moved.
I can see two ways of coding this.
case 1:
Sub work(sourceBm As Bitmap) As Bitmap
Dim localReturnBm As Bitmap
'do something with sourceBm and put it in localReturnBm
Return localReturnBm
End Sub
and called as :-
Dim bitmapToDisplay As Bitmap
bitmapToDisplay= work(originalBitmap)
case 2:
Sub work(sourceBm As Bitmap, returnBm As Bitmap)
'do something with sourceBm and put it in returnBM
End Sub
and called as :-
Dim bitmapToDisplay As Bitmap
work(originalBitmap, bitmapToDisplay)
Do these cases create and/or destroy the same number of bitmaps?
I realise there are ways of slowing down the creation rate in this example but it would be good to have a picture of the inside workings of the sub/return object mechanism.
As an example - GaussianBlurring a bitmap as a slider specifying the blur radius is moved.
I can see two ways of coding this.
case 1:
Sub work(sourceBm As Bitmap) As Bitmap
Dim localReturnBm As Bitmap
'do something with sourceBm and put it in localReturnBm
Return localReturnBm
End Sub
and called as :-
Dim bitmapToDisplay As Bitmap
bitmapToDisplay= work(originalBitmap)
case 2:
Sub work(sourceBm As Bitmap, returnBm As Bitmap)
'do something with sourceBm and put it in returnBM
End Sub
and called as :-
Dim bitmapToDisplay As Bitmap
work(originalBitmap, bitmapToDisplay)
Do these cases create and/or destroy the same number of bitmaps?
I realise there are ways of slowing down the creation rate in this example but it would be good to have a picture of the inside workings of the sub/return object mechanism.