This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, October 30, 2009 12:12:21 PM(UTC)
Groups: Registered
Posts: 10
Leadtools 14.5
Visual Studio 2005 vb.Net
I know the question must be answered already but here it goes:
How can I create a Blank RasterImage with a specific width and height, for Blank I mean a White Image, if you can post some code I will really aprecciate.
I tried this:
Private Function CreateTest(ByVal Width As Integer, ByVal Height As Integer) As IRasterImage
Dim CreateParameters As RasterImageCreateParameters = New RasterImageCreateParameters
CreateParameters.BitsPerPixel = 24
CreateParameters.ManagedBuffers = 0
CreateParameters.ManagedTiles = 0
CreateParameters.DitheringMethod = RasterDitheringMethod.None
CreateParameters.Height = Height
CreateParameters.MaximumConventionalSize = 100 * 1024 * 1024
CreateParameters.MemoryFlags = RasterMemoryFlags.User
CreateParameters.NoRegionClip = True
CreateParameters.Order = RasterByteOrder.Bgr
CreateParameters.TemporaryDirectory = "c:\"
CreateParameters.Palette = Nothing
CreateParameters.TiledThreshold = -25
CreateParameters.TileSize = 0
CreateParameters.ViewPerspective = RasterViewPerspective.TopLeft
CreateParameters.Width = Width
CreateParameters.XResolution = 0
CreateParameters.YResolution = 0
CreateParameters.UsePaletteAsLookupTable = False
CreateParameters.UserData = Nothing
CreateParameters.UserMatchTable = Nothing
'Create the image.
Dim LeadImage As IRasterImage = New RasterImage(CreateParameters)
If (LeadImage.IsAllocated) Then
Return (LeadImage)
Else
MessageBox.Show("Error, The create process failed. ", "Create Image")
Return (Nothing)
End If
End Function
but it did not work for me, when I tried to Fill with a white color i got the message
"Object reference not set to an instance of an object."
am I missing something?
Thanks
Jorge
#2
Posted
:
Sunday, November 1, 2009 2:41:08 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Jorge,
In your code, you are setting the RasterImageCreateParameters.MemoryFlags to RasterMemoryFlags.User. Try to set the MemoryFlags property to RasterMemoryFlags.Managed and retry the same issue.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.