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.

Alpha Image Device

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-05-2009, 08:44 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default Alpha Image Device

Here is a library that I created a few months ago for loading Alpha transparent Images on the PPC.
It utilizes a Com component called IImagingfactory that was implemented in Windows Mobile 5.
So this will only work with WM5 or higher with .NET Compact Framework 2.0 or higher.

The methods of interest are DrawImage and ImageOnSection.
Images can be loaded from file, byte[] array, or an embedded resource.

GetImageSection will get a section of the back image that can be used with any control supporting images.
ImageSection is a reference to that image.

Images can be drawn in the foreground, allowing for dynamic replacement.
Background images should be loaded before any foreground otherwise some images will be lost.
An embedded image in a seperate Dll can be loaded with GetImageResource , for those that are able to do so.

DrawString is included which is able to draw text centered on the form, AlphaBlend is also included.

This is a a fully functional beta release that will likely change in the future.
Have Fun , and please post any Questions Comments or Requests.
Attached Files
File Type: zip Alpha6.zip (127.6 KB, 84 views)

Last edited by eww245 : 12-06-2009 at 06:12 AM.
Reply With Quote
  #2 (permalink)  
Old 10-05-2009, 08:44 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

This spot was saved for a compiler utility that I finally got around to writing.
A new thread has been opened for it http://www.basic4ppc.com/forum/addit...html#post30322

Last edited by eww245 : 12-06-2009 at 06:57 AM.
Reply With Quote
  #3 (permalink)  
Old 10-06-2009, 12:40 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Have you got a demo app you could post? Also a compatible desktop library for development would be useful. The present library needs to be added to the desktop for optimised compiling to work but the desktop crashes if you try to run it.

It looks like at the moment it only works for Form images. It would be nice if there was an AlphaBitmap class that drew on an internal bitmap and could open and blend images with alpha values. If it returned that internal image as a Value property it could then be used in conjunction with ImageLib and ImageLibEx bitmaps. I don't know if a bitmap format conversion would be needed or not - I'm not so hot on graphics stuff.

I suspect, but haven't tried, that it will need some modification to work when AutoScale compiled. http://www.basic4ppc.com/forum/beta-...libraries.html
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #4 (permalink)  
Old 10-06-2009, 09:22 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post
Have you got a demo app you could post? Also a compatible desktop library for development would be useful. The present library needs to be added to the desktop for optimised compiling to work but the desktop crashes if you try to run it.

It looks like at the moment it only works for Form images. It would be nice if there was an AlphaBitmap class that drew on an internal bitmap and could open and blend images with alpha values. If it returned that internal image as a Value property it could then be used in conjunction with ImageLib and ImageLibEx bitmaps. I don't know if a bitmap format conversion would be needed or not - I'm not so hot on graphics stuff.

I suspect, but haven't tried, that it will need some modification to work when AutoScale compiled. http://www.basic4ppc.com/forum/beta-...libraries.html
ImageSection would be that value, but it is not settable.

What I'll do is add another method that can draw a Bitmap on it and also make the property settable.

I'm quite spoiled by the device IDE, it's where I develop everything and only use the desktop for compiling and it doesn't crash.
The cPPc property didn't work for me before, I'll just have to figure it out.

As of now I don't think I'll be able to make a Desktop version, other than a dummy.

Right now I'm adding some new features so I'll get a demo ready when it's done.
Reply With Quote
  #5 (permalink)  
Old 10-07-2009, 07:59 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by eww245 View Post
As of now I don't think I'll be able to make a Desktop version, other than a dummy.
Why not? It would be a shame if you didn't and you seem more than competent enough! I would have thought it would be easier on the desktop as the GDI+ stuff is exposed in .NET, so you don't need COM, and AlphaBlend is in gdi32.dll.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #6 (permalink)  
Old 10-07-2009, 09:41 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post
Why not? It would be a shame if you didn't and you seem more than competent enough! I would have thought it would be easier on the desktop as the GDI+ stuff is exposed in .NET, so you don't need COM, and AlphaBlend is in gdi32.dll.
Ok, I'll check it out.
Reply With Quote
  #7 (permalink)  
Old 10-12-2009, 12:37 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Good work ,eww245! I'm hope you don't throw it!
Without sample i can't understand...this lib can load Alpha Transparented images from png\ico and draw it (now on form)?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #8 (permalink)  
Old 10-16-2009, 04:17 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Byak@ View Post
Good work ,eww245! I'm hope you don't throw it!
Without sample i can't understand...this lib can load Alpha Transparented images from png\ico and draw it (now on form)?
Yes it can draw png's with an alpha channel. No it does not load ico's, but I'll look in to it.

For now I'm not going into too much detail here but I have added a bunch.

There are three classes Alpha AlphaImage ImageList
I took agrahams suggestion and added the seperate class for a non form image.
ImageList was added for regular Bitmaps because Basic4ppc ImageList only keeps a reference to an image, not making a copy.

AlphaImage has AdjustBrightness, AdjustContrast, AdjustGamma, Rotate and Flip along with the same methods as Alpha.
These are part of the IBitmapImage object that I've finally been able to understand.
Anyone's guess is as good as mine for the value ranges, except for Flip, it is bool and bool.

I removed drawing in the foreground, Form.DrawImage acts as a foreground so it's not needed.
Also a memory leak, I believe, is solved, at least for most methods.

The first post has been updated with these changes and a demo, Door and BinaryFile are needed.
BinaryFile is a complement to this as the embedded images can be loaded into a byte[] array.
Door isn't needed but a few methods helped with the demo.

I'm still finding something new with this often so this could eventually be quite a large library.
Reply With Quote
  #9 (permalink)  
Old 10-19-2009, 04:13 PM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

oo,It is a really good work!many thanks!
maybe you create a dummy(or not) lib for PC?some of my projects work on Desctop and on device.
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #10 (permalink)  
Old 10-19-2009, 06:35 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Byak@ View Post
oo,It is a really good work!many thanks!
maybe you create a dummy(or not) lib for PC?some of my projects work on Desctop and on device.
Yes, I have started working on a Desktop version, but having trouble with the AlphaBlend API.
No errors it just won't work.
Transparency obviously isn't a problem on the Desktop.

I'm trying to figure out an equivalent for Flip Brightness Gamma and Contrast.
For the device it now will only make these changes to the transparent image, not effecting the backimage.

I'll update it here as soon as I resolve some of these issues.


There is the ability to install, uninstall, Encoders and Codecs.
I'm guessing creating custom versions.
And a huge list of ImageTags that can be set or retrieved.
Although this is probably more difficult I'm willing to try it if anyone is intrested.

PropertyTag Values
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
Alpha channel transparent Byak@ Questions (Windows Mobile) 15 04-23-2010 05:32 PM
PNG Alpha transparent vs Sprites Byak@ Questions (Windows Mobile) 12 10-05-2009 08:47 PM
Image width on VGA device agraham Bug Reports 7 12-04-2008 08:11 PM
Video or Picture with Alpha over live camera? realvision Code Samples & Tips 0 04-01-2008 12:12 AM
No 8-bit alpha for transparent pngs? Mistrel Questions (Windows Mobile) 2 10-13-2007 06:39 AM


All times are GMT. The time now is 06:57 AM.


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