Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

ImageLibEx library

Reply
 
LinkBack Thread Tools Display Modes
  #121 (permalink)  
Old 11-23-2009, 01:11 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I assume that mapslist is a Basic4ppc ImageList. It looks to me like a problem with that. I've not looked at ImageList before and assumed it stored bitmap references. In fact it appears that it can store bitmaps as both string filenames and as bitmap references. As ImageList is not as separate control but is implemented by inline code in both the IDE and optimising compiler I can't be sure but it looks as though normally the IDE/compiler compensates for this but in your instance it may not be and is passing an image filename as a string to DrawImage - hence the complaint.

The above is my best guess unless you can post some code that displays this behaviour.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #122 (permalink)  
Old 11-23-2009, 02:07 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Andrew
I feel that you are right, I am going to check it - by assigning the imagelist item to a bitmap, and from there to the drawer.

Thanks

Edit: Yes, that solved the problem.
Thanks again !
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 11-23-2009 at 02:12 PM.
Reply With Quote
  #123 (permalink)  
Old 11-23-2009, 04:25 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I'm having a bad few days suffering from a bad winter cold and I suspect my glib reasoning above is not the reason for the problem as I am now doubting my observation about both string names and references being stored in an ImageList. However it does seem that ImageLists, or at least, what is returned from the ImageList.Item(x) method, are treated differently in the IDE and when optimised compiled so I don't really understand what is going on here.

It seems when optimised compiled an ImageList should only contain references, as I previously assumed, so I have no idea why it was trying to pass a string to DrawImage. Perhaps Erel might shed some light on this as it looks like it might be a bug.

You didn't confirm that mapslist was a Basic4ppc ImageList but it seems so.

Was the offending image assigned to the ImageList at design or runtime?

Did this happen with more than one image?

Were there a misture of images in the ImageList assigned at design and runtime?

Is "compilation to desktop " optimised compiled?

You don't have some example code that produces the problem you could post do you?
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 11-23-2009 at 04:32 PM.
Reply With Quote
  #124 (permalink)  
Old 11-23-2009, 06:09 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Andrew

Quote:
You didn't confirm that mapslist was a Basic4ppc ImageList but it seems so.
Sorry for omitting what was clear for me, yes it is.

Quote:
Was the offending image assigned to the ImageList at design or runtime?
At runtime, the list contains 10 maps of 1000*1000, they are assigned by: mapslist.item(i) = [filename]

Quote:
Did this happen with more than one image?
- yes.

Quote:
Were there a misture of images in the ImageList assigned at design and runtime?
No, all 10 are assigned at runtime.

Quote:
Is "compilation to desktop " optimised compiled?
Yes.

Quote:
You don't have some example code that produces the problem you could post do you?
No, I have a small test program in which the problem does not appear and I attach it without the map (which is 467 KB).

In the meantime - my nav prog is running with the intermediate image but it slows the process meaningfully, so enabling the use of imagelist item in the darwimage will be great advantage for me.

Thank you.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #125 (permalink)  
Old 11-23-2009, 06:51 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by derez View Post
No, I have a small test program in which the problem does not appear and I attach it without the map (which is 467 KB).
I am afraid that is not much help. I, or Erel, need to see the problem. I suspect something in the code of the failing application may be confusing the optimised compiler.

To look further we would need either some failing source code or a zip of the Class1.cs file produced after compiling the failing application which is in YourUserName\AppData\Roaming\Anywhere Software\Tzor in Vista or Documents and Settings\YourUserName\Application Data\Anywhere Software\Basic4ppc\Tzor in XP and indicate the name of the Sub where the bitmaps are assigned to the ImageList and also the Sub name where the DrawImage fails.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #126 (permalink)  
Old 11-23-2009, 09:06 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Sorry, that code is not for publishing.
I'll try to create the error in a demo program.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #127 (permalink)  
Old 11-24-2009, 07:25 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

The relevant subs:
Initializing the mapslist content:
Code:
...
For i = 1 To 10
  mapslist.Add(AppPath & 
"\maps\blank.jpg")
Next
...
then the runtime assignment of maps:
Code:
Sub replace_all_maps(a,b)
temp = map_header
ind = 
0
For i = a-1 To a+1
  
For j = b+1 To b-1 Step - 1
    ind = ind + 
1
    FN = temp & Format(i,
"D2") & Format(j,"D2") & ".jpg"
    
If FileExist(FN) Then  mapslist.Item(ind) = FN     Else mapslist.Item(ind) = mapslist.Item(0)

  
Next
Next
End Sub
The relevant part of sub Israel_map_move:

Code:
...
mapdst.New1(
0,0,IW,IH)
mapsrc.New1(left,top,IWZ,IHZ)
'image1.Image = mapslist.item(5)
drx.DrawImage(mapslist.item(5),mapsrc.Value,mapdst.Value,False)
...
If I replace the "mapslist.item(5)" by the image1.image after assigning it the item - it works.

The error appears only in runtime, not while compiling. It was optimized compiled for desktop.

I attach the class1.cs file.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 11-24-2009 at 07:29 AM.
Reply With Quote
  #128 (permalink)  
Old 11-24-2009, 10:14 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

It's a bug in your code I'm afraid ( EDIT - no it's not ). I've rearranged the IF statement as I don't like single line IFs.

Code:
If FileExist(FN) Then
    mapslist.Item(ind) = FN <font color=
"Red">' Error! assigning a string not an image</font>
Else
    mapslist.Item(ind) = mapslist.Item(
0) <font color="SeaGreen">' OK, this is an image assignment</font>
End If
This works in the IDE because the assignment checks if a string is being assigned and reads the bitmap from the file if it is a string. The optimising compiler just does the assignment without checking.

EDIT:- I've just looked at the help for ImageList.Item and it states that what you are doing should work so it looks like a compiler bug.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 11-24-2009 at 12:15 PM.
Reply With Quote
  #129 (permalink)  
Old 11-24-2009, 12:52 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Andrew

You say it is a compiler bug. Is it even so that the error appears in runtime, not while compiling ?
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #130 (permalink)  
Old 11-24-2009, 01:12 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Yes. In order to do what the help says is permissible, and works in the IDE, the compiler should be compiling a call to a function called GetBitmapFromString which checks at runtime whether the assignment is a string and if so reads a bitmap from the filename specified by the string. The compiler does this for the parameter to ImageList.Add(something) producing
ImageList.Add(GetBitmapFromString(something))
but not for an assignment to ImageList1.Item(somewhere) where it produces
ImageList1.Item(somewhere) = something
instead of
ImageList1.Item(somewhere) = GetBitmapFromString(something)
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Door library (Beta) - Special library Erel Official Updates 60 01-13-2011 12:23 PM
Merging Outlook library and Phone library Erel Official Updates 11 09-15-2010 10:22 AM
PhoneticAlgorithms Library (ex-StringComparison Library) moster67 Additional Libraries 10 11-11-2008 08:46 PM
ImageLibEx? agraham Basic4ppc Wishlist 2 11-05-2007 02:15 PM
ImageLibeX Error XerVision Questions (Windows Mobile) 8 08-27-2007 07:14 PM


All times are GMT. The time now is 02:16 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0