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.

ImageCompiler

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-06-2009, 06:54 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default ImageCompiler

ImageCompiler is a small Desktop only program written in Basic4ppc that will embed images into a .dll
Both .Net Framework 2.0 and .Net CompactFramework 2.0 are required.

The resulting library can be used for the Device and Desktop, a Desktop only option is included.
It will contain two methods.

GetBitmap - returns a standard .Net Bitmap
GetStream - returns the raw data as a Stream

For all of the images embedded there will be a property that gets the resource name as a string.

ImageCompiler.GetBitmap(ImageCompiler.ImageName) - will return a Bitmap
ImageCompiler.GetStream(ImageCompiler.ImageName) - will return a Stream
This can be used with my http://www.basic4ppc.com/forum/addit...ge-device.html library on the Device or Desktop

The program source is available and has comments on how to draw to an Image object or to an AlphaImage object.

It is possible to embed any type of file into the library.
I haven't tested it but, the BinaryFile library should be able to read the Stream data or write it to a file.
Edit: Yes it does work with any file and with BinaryFile library.
Attached Files
File Type: zip ImageCompiler4.zip (23.6 KB, 45 views)

Last edited by eww245 : 12-11-2009 at 12:19 PM.
Reply With Quote
  #2 (permalink)  
Old 12-08-2009, 12:24 PM
Knows the basics
 
Join Date: Aug 2008
Location: Russia, Perm
Posts: 70
Send a message via ICQ to Aspire89
Default

Thank you. A very useful application, but on Windows 7, not created .dll file. In the folder with .exe is created .cs file and all. . Net Framework 2.0 and. Net CompactFramework 2.0 installed. In what could be the problem?
__________________
A&R Software Team
Reply With Quote
  #3 (permalink)  
Old 12-09-2009, 02:31 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Aspire89 View Post
Thank you. A very useful application, but on Windows 7, not created .dll file. In the folder with .exe is created .cs file and all. . Net Framework 2.0 and. Net CompactFramework 2.0 installed. In what could be the problem?

Try the new version. It now should check for a 64bit system and "C:\" drive was replaced with "\" to be sure the path is the system drive.

Let me know if it works..
Reply With Quote
  #4 (permalink)  
Old 12-09-2009, 03:03 PM
Knows the basics
 
Join Date: Aug 2008
Location: Russia, Perm
Posts: 70
Send a message via ICQ to Aspire89
Default

Tried, still does not work. System 32 bit. If you do not add a single image, then created .dll file size of 3.5 kb. When compiling a console window appears but does not have time to read the text of the error. Examined the way, all the folders and files exist.
__________________
A&R Software Team
Reply With Quote
  #5 (permalink)  
Old 12-10-2009, 03:33 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Aspire89 View Post
Tried, still does not work. System 32 bit. If you do not add a single image, then created .dll file size of 3.5 kb. When compiling a console window appears but does not have time to read the text of the error. Examined the way, all the folders and files exist.
Ok So it at least finds the .Net libraries, I thought that was the problem.
If the image name is for ex, img...png it won't work.
If it is file.img.png it should work but it would end up being just img.png.
What about a space in the file or library name, I don't think I included the "" quotes for those parameters.

Did you only try with Windows 7?
I'll add a log file output and or use a bat file so we can see what is happening.

Edit: Nevermind my fault I missed 1 " quote.
Basic4ppc won't see it as an error only the C# compiler.
Not sure how I missed this one, others should have had the same problem.
I'll fix it when I get home from work.

Last edited by eww245 : 12-10-2009 at 04:28 AM.
Reply With Quote
  #6 (permalink)  
Old 12-10-2009, 11:49 AM
Knows the basics
 
Join Date: Aug 2008
Location: Russia, Perm
Posts: 70
Send a message via ICQ to Aspire89
Default

Check other operating system is not possible. Filenames 1.png 2.png 3.png etc.
__________________
A&R Software Team
Reply With Quote
  #7 (permalink)  
Old 12-10-2009, 03:23 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Aspire89 View Post
Check other operating system is not possible. Filenames 1.png 2.png 3.png etc.
This new one should fix it. I also found another bug with selecting files that is also fixed.
Reply With Quote
  #8 (permalink)  
Old 12-10-2009, 03:38 PM
Knows the basics
 
Join Date: Aug 2008
Location: Russia, Perm
Posts: 70
Send a message via ICQ to Aspire89
Default

Many thanks, works fine.
__________________
A&R Software Team
Reply With Quote
  #9 (permalink)  
Old 12-11-2009, 11:47 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

There was a problem with adding files from a drive other than the system drive.
It would only compile if the last file was the system drive.
This was due to removing the C: for the .Net libraries path.

Now it will search for the drive with the windows directory until it is found.
Version number and copyright info can be added to the library.

Here is some code using the BinaryFile library for anyone interested in compiling files rather than images.
Or wanting to save an image to file.

Code:
Sub Globals
  
Dim bytes(0As Byte
End Sub

Sub App_Start
  Compiler.New1

  
'Get the raw bytes
  bin.New1(Compiler.GetStream(Compiler.FileName), false)
  
Dim bytes(bin.Length) As Byte
  bin.ReadBytes(bytes(), ArrayLen(bytes()))

  
'Save it to a file
  FileOpen(f, "file.ext", cRandom)
    bin.New1(f, 
false)
    bin.WriteBytes(bytes())
  FileClose(f)
 bytes() = 
0
End Sub

Last edited by eww245 : 12-11-2009 at 12:21 PM.
Reply With Quote
  #10 (permalink)  
Old 12-12-2009, 09:24 AM
Knows the basics
 
Join Date: Aug 2008
Location: Russia, Perm
Posts: 70
Send a message via ICQ to Aspire89
Default

A small request. Move the list of add images in a separate file. For example list.txt, containing:
c:\1.jpg
c:\2.jpg
c:\3.jpg
etc.
When more than 20 images, uncomfortable one file to add.
Thank you.
__________________
A&R Software Team
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


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


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