Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
photo_tom  
#1 Posted : Friday, March 19, 2004 8:58:00 PM(UTC)
photo_tom

Rank: Member

Groups: Member
Joined: 11/27/2003(UTC)
Posts: 29

The following code is giving me an invalid cast error message

Code:
                Dim hist(255) As Long
                hist = gm.Data.GetHistogram(GraphicsMill.Channel.ChannelAll)

All I'm trying to do is get the histogram. The GM object has been used for other funcitons to this point, so I know it is okay.

Also

Code:
       Dim hist() As Long
       hist = gm.Data.GetHistogram(GraphicsMill.Channel.ChannelAll)

gives me the same message

Edited by user Monday, December 24, 2007 6:08:52 PM(UTC)  | Reason: Not specified

Tom Thorp

Still waters, great photos

Andrew  
#2 Posted : Sunday, March 21, 2004 12:59:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Histogram is returned as an array of VARIANTs (to be able to work with it in ASP). That's why you should try to declare an non-typed array (or array of objects):

Dim hist(255)

hist = objBitmap.Data.GetHistogram(GraphicsMill.Channel.ChannelAll)

photo_tom  
#3 Posted : Sunday, March 21, 2004 7:09:00 PM(UTC)
photo_tom

Rank: Member

Groups: Member
Joined: 11/27/2003(UTC)
Posts: 29

It works. Thanks

The only problem is that this generates some "untyped" code which is a little bit against how things are suppose to work in .NET. Also, because it is "untyped", it runs some slower.

Tom Thorp

Still waters, great photos

Andrew  
#4 Posted : Monday, March 22, 2004 12:53:00 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Unfortunately untyped array is unavoidable in this situation. However if you use histograms array heavily, and it adversely affect the performance, you can copy this array into array of Long. Something like this:

Code:
Dim hist(255)
hist = objBitmap.Data.GetHistogram(Aurigma.GraphicsMill.Channel.ChannelAll)

Dim histLong(255) As Long
Dim I As Long
For I = LBound(hist) To UBound(hist)
    histLong(I) = hist(I)
Next I

It should not give big overhead, especially if you access this array many times. But of course, if you need to fulfill single pass through its items, it makes no sense.

Edited by user Monday, December 24, 2007 6:09:04 PM(UTC)  | Reason: Not specified

Fedor  
#5 Posted : Sunday, January 2, 2005 9:52:00 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Now you can use Graphics Mill for .NET, which is native .NET component.
Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
Forum Jump  
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.