Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, October 30, 2009 12:12:21 PM(UTC)

jraggio  
jraggio

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
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, November 1, 2009 2:41:08 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.106 seconds.