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
  #161 (permalink)  
Old 02-26-2010, 11:27 AM
ceaser's Avatar
Basic4ppc Veteran
 
Join Date: May 2008
Location: Paarl, South Africa
Posts: 306
Default

Thanks Klaus and Agraham
Reply With Quote
  #162 (permalink)  
Old 03-23-2010, 05:52 PM
Knows the basics
 
Join Date: Sep 2008
Posts: 82
Default

I try to use the slideshow function like an background effect but after the effect the transparency labels aren't transparent
And the effect is very slow in my emulator
How can I do it faster?

Here is my code:

Code:
Public Sub formFadeShow (ParentForm,TargetForm)
    FadedForm = 
"Main."&TargetForm
    imgTargetBg = 
"Main.img"&TargetForm&"Bg"
    CapFade.New1
    CapFade.ControlCapture(
"Main."&ParentForm,0,0,240,320)
    Control(imgTargetBg,Image).Image = CapFade.Image
    imgCapture.Image = CapFade.Image
    BmExFade1.New3(imgCapture.Image)
    BmExFade2.New2(imgFadeBg.Width,imgFadeBg.Height)
    DrawExFade.New2(BmExFade2.Value)
    DrawExFade.Clear(cBlack)
    ShowFade.New1
    ShowFade.NewTransition(BmExFade1.Value,BmExFade2.Value,cGray,
True)
    timFadeIn.Interval = Interval
    timFadeIn.Enabled = 
True
    Control(
"Main."&TargetForm,Form).Show
End Sub

Sub timFadeIn_Tick
    Percent = Percent + Increment
    Control(imgTargetBg,Image).Image = ShowFade.Fade(Percent)
    
If Percent >= FadeContrast Then
        timFadeIn.Enabled = 
False
        Percent = 
0
    
End If
End Sub
And the result:
Attached Images
File Type: jpg ScreenShot.jpg (14.5 KB, 21 views)
Reply With Quote
  #163 (permalink)  
Old 03-23-2010, 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

If by emulator you mean the Microsoft device emulator running on the desktop then yes, it is slow and no, you can't get it to go faster.

You should be calling EndTransition after the fade has finished.

I am not entirely certain what your controls and objects are. It is always best to post a small sbp file that will run so we can see the problem. Otherwise we just waste time trying to guess what you are doing.

In this case my guess is that "Main.img"&TargetForm&"Bg" is an Image control and things don't work the way you think. A transparent label draws itself using the image of the form or panel on which it is located. remove the image control and try setting Form.Image with the fade. I don't know if that will work, if you had posted a demo of the problem I would probably have tried a quick mod to test it but I'm not going to waste time trying to re-implement what I think you are doing.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #164 (permalink)  
Old 06-08-2010, 10:26 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Concerning AutoScale.
I had the feeling, on my htc Touch HD, for quite some time, that the refreshing of the screen with AutoScale and the ImageLibEx is very slow on a Form's forelayer, but had never made any comparisons yet. But now this has been done.

Attached several source codes showing the problem:
- TestMouseMove with
drwMainF.RefreshForm2("frmMain",rectDest.Value)
very slow
- TestMouseMove1 with frmMain.Refresh faster but still slow
- TestMouseMoveVGA, true Vga, with frmMain.Refresh, much faster !

I'm about thinking that I will abandon using AutoScale, directly program for VGA, and change the dimensions of the controls and fonts to QVGA.
This question is also open for the future, would the standard screen size be VGA and have an AutoScale for 'older' QVGA screens, or still remain with the standard QVGA screen and AutoScale to VGA ?

There is also a 'strange' need for the destination rectangle definition with AutoScale for the device if the x and y coordinates are different to ZERO.
Code:
<font face="Courier New"><font size="2"><font face="Courier New"><font size="2">rectDest.New1(ScreenX0,ScreenY0,ScreenX0+ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenY0+ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font>
and not
Code:
<font size="2"><font face="Courier New"><font size="2"><font face="Courier New">rectDest.New1(ScreenX0,ScreenY0,ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font>
I hope that the explanations a clear !?

Best regards.
Attached Files
File Type: sbp TestMouseMove.sbp (3.2 KB, 5 views)
File Type: sbp TestMouseMove1.sbp (3.2 KB, 4 views)
File Type: sbp TestMouseMoveVGA.sbp (2.8 KB, 3 views)
__________________
Klaus
Switzerland

Last edited by klaus : 06-09-2010 at 06:32 AM.
Reply With Quote
  #165 (permalink)  
Old 06-09-2010, 10:28 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

I am a bit surprised that there is a difference between DrawerEx.RefreshForm2 and Form.Refresh as they both do much the same thing, they mark an area of the form invalid and so force a repaint of the form. It is the repainting of the Form that takes the time, not the invalidation. None of the methods in ImageLibEx do any extra work when AutoScaled so the performance hit is not in the library. It may be that callling Refresh on the form forces an immediate call directly to repaint whereas invalidating and then repainting an area may have to go via messages to the application message loop and so may be actually be slower - but I don't know about those internal implementation details. I would just use whatever is fastest

An AutoScaled Form still has QVGA sized bitmaps internally and on a repaint they are stretched to fit the VGA screen making the VGA image a bit "fuzzy". I guess this stretching is where the performance penalty over true VGA is.

Have you tried NativeImage and NativeFormImage from the ControlsExDevice library with AutoScale? They should give you the benefits of AutoScaling the controls but let you control the graphics yourself. I would expect their performance to be the same whether AutoScaled or not. In this case using Form.Refresh avoids some confusion over the area to invalidate (described in the help) and as you noted may even be faster.

Quote:
There is also a 'strange' need for the destination rectangle definition with AutoScale for the device if the x and y coordinates are different to ZERO.
Are you referring to the use of the Rectangle in RefreshForm2? As I said above ImageLibEx does no AutoScale processing so the invalidated area is defined in screen co-ordinates not in notional QVGA co-ordinates. I would however expect to use -

Code:
rectDest.New1(ScreenX0*ScreenScaleX, ScreenY0*ScreenScaleY, ScreenW*ScreenScaleX, ScreenH*ScreenScaleY)
Your code includes an unnecessary area to top and left of the required rectangle - but as Form.Refresh seems quicker perhaps this is an academic point.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #166 (permalink)  
Old 06-09-2010, 01:45 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Coming back to the rectangle definition.
For copying a partial image on the screen.
When running the attached program, on the device AutoScale compiled, the graphic is not at the right place with:
Code:
<font face="Courier New"><font size="2"><font face="Courier New"><font size="2">rectDest.New1(ScreenX0, ScreenY0, ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">, ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
<font size=
"2"><font face="Courier New">rectSrc.New1(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font></font></font>
clicking on the Rect button sets:
Code:
<font face="Courier New"><font size="2"><font face="Courier New"><font size="2">rectDest.New1(ScreenX0, ScreenY0, ScreenX0+ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">, ScreenY0+ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
<font size=
"2"><font face="Courier New">rectSrc.New1(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenX0+ScreenW*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleX</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,ScreenY0+ScreenH*</font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">ScreenScaleY</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font>
and the graphic is on it's right place.

The same happened with the Refresh function and the rectangle in the TestMouseMove program.

I have not yet tried the NativeImage object, will do it quite soon.

Best regards.
Attached Files
File Type: sbp TestMouseMove_N.sbp (5.7 KB, 4 views)
__________________
Klaus
Switzerland
Reply With Quote
  #167 (permalink)  
Old 06-09-2010, 03:13 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 am afraid that you are confusing things by using the same Rectangle for drawing as for refreshing. Replace all the drwMain.RefreshForm2 with frmMain.Refresh and remove all the ScreenScaleX and ScreenScaleY scaling from rectDest and you will find it works fine when AutoScaled. The drawing rectangle needs to be specified in QVGA co-ordinates because it is drawing on a QVGA sized bitmap in the form - this is the whole point of AutoScale, it uses QVGA co-ordinates. The refresh rectangle needs to be specified in physical screen co-ordinates because it needs to invalidate the actual area drawn on the screen.

So if you have a drawing rectangle

rectDest.New1(ScreenX0, ScreenY0, ScreenW, ScreenH)

you need a refresh rectangle

rectRefresh.New1(ScreenX0*ScreenScaleX, ScreenY0*ScreenScaleY, ScreenW*ScreenScaleX, ScreenH*ScreenScaleY)

or just use Form.Refresh.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #168 (permalink)  
Old 06-09-2010, 03:58 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Thank you Andrew, now it has become clear for me.

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #169 (permalink)  
Old 07-17-2010, 03:23 PM
ceaser's Avatar
Basic4ppc Veteran
 
Join Date: May 2008
Location: Paarl, South Africa
Posts: 306
Default

Hi Agraham

Thanks for a wonderful and powerful library. I have rewritten my CAD program using your library and will post it soon on the forum.

Just one thing. Is it please possile to add a function to draw an arc by defining three points on the arc? How about defining one's own line types i.e. a fenceline, etc.

Regards
Michael
Reply With Quote
  #170 (permalink)  
Old 07-17-2010, 04:46 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 ceaser View Post
Just one thing. Is it please possile to add a function to draw an arc by defining three points on the arc
If you can give me an algorithm I'll look at it.
Quote:
How about defining one's own line types i.e. a fenceline, etc.
I've no idea what a fenceline is but look at DrawerEx.DrawLineDashDot.
__________________
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:17 AM.


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