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

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Bitmap Value Lost?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-16-2008, 01:47 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Default Bitmap Value Lost?

Hi all.

I finally buy this wonderfull app.
Now i have more doubts than ever!

I have problems using imagelib library.
The problem is the following, when i create a bitmap with backdrop image, I create a drawer and paint a bit image over previous, using drawer.drawimage1
When I first time, try to draw in a gamewindow.drawbackgroundimage2, all seems to be correct, but the second time, value doesn't work.
I have to use an intermediate image for storing value of backdropbitmap and reassign every time.

The code is follow.

Code:
Sub UpdateForm(x, y)
    CellBitmap.New1(AppPath & 
"\images\cell.png")
    
'BackdropBitmap.New3(TmpBackdropBitmap.Value)
    CellRectangle.New1(00, CellBitmap.Width, CellBitmap.Height)
    BackdropRectangle.New1(x, y, CellBitmap.Width, CellBitmap.Height)
    GameFormDrawer.New2(BackdropBitmap.Value, B4PObject(
5))
    GameFormDrawer.DrawImage1(CellBitmap.Value, CellRectangle.Value, BackdropRectangle.Value, 
false)
    GameFormDrawer.Refresh2(BackdropRectangle.Value)
    
'TmpBackdropBitmap.New3(BackdropBitmap.Value)
    GameGameWindow.DrawBackgroundImage2(BackdropBitmap.Value)
End Sub
This methods seems to work, but i wonder why i have to create new BackdropBitmap referencing to previous (TmpBackdropBitmap).

I commented 2 lines needed to work, and i wonder why I need this 2 lines.

Any Clues?

Thanks in advance.

fjsantos.
________
XVZ1300

Last edited by fjsantos : 01-24-2011 at 10:39 PM.
Reply With Quote
  #2 (permalink)  
Old 06-16-2008, 02:37 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Could you post your whole code, it would be easyer to look what happens, the kind of objects and their context.

What function is this:
GameGameWindow.DrawBackgroundImage2(BackdropBitmap .Value)
I don't know this one.

Best regards
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #3 (permalink)  
Old 06-16-2008, 03:37 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Default

Hi Klaus

Thanks for helping.

Code is a bit large so I extract important part.

Code:
Sub App_Start
    GameFormLib.New1(
"GameForm", B4PObject(1))
    GameGameWindow.New1(
"GameForm"00, WIDTH, HEIGHT)
    GameGameWindow.DrawBackgroundImage(AppPath & 
"\images\backdrop.png")
    ObjectDoor.New1(
False)
    ObjectDoor.FromControl(
"GameForm")
    ObjectDoor.SetProperty(
"KeyPreview"True)
    TmpBackdropBitmap.New1(AppPath & 
"\images\backdrop.png")
    GameForm.Image = TmpBackdropBitmap.Value
    GameForm.Show
    GameForm.ForeLayer = 
True
    CreateCloseButton
    CreateNewCell
    UpdateForm1
    MoveCellTimer.Enabled = 
True
End Sub

Sub UpdateForm1
    CellBitmap.New1(AppPath & 
"\images\cell.png")
    CellRectangle.New1(
00, CellBitmap.Width, CellBitmap.Height)
    BackdropRectangle.New1(
00, CellBitmap.Width, CellBitmap.Height)
    GameFormDrawer.New1(
"GameForm"True)
End Sub

Sub UpdateForm(x, y)
    BackdropRectangle.X = x
    BackdropRectangle.Y = y
    GameFormDrawer.DrawImage1(CellBitmap.Value, CellRectangle.Value, BackdropRectangle.Value, 
False)
    GameFormDrawer.Refresh2(BackdropRectangle.Value)
    GameGameWindow.DrawBackgroundImage2(GameForm.Image)
End Sub
The first time GameGameWindow draws GameForm.Image all seems to be ok, but the second one, its fails 'Parameter is not valid'.

Thanks, fjsantos.
________
DR-Z400

Last edited by fjsantos : 01-24-2011 at 10:39 PM.
Reply With Quote
  #4 (permalink)  
Old 06-16-2008, 04:08 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Can you zip and upload your complete project?
There may be an issue here with how images are stored internally.
Reply With Quote
  #5 (permalink)  
Old 06-16-2008, 04:17 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Default

Of course I can.

Here it go.

Best Regards, fjsantos.
________
buy volcano vaporizer

Last edited by fjsantos : 01-24-2011 at 10:39 PM.
Reply With Quote
  #6 (permalink)  
Old 06-16-2008, 05:07 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Erel is of course more competent to solve your problem than myself. I have never used the Sprite library.

Best regards
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #7 (permalink)  
Old 06-16-2008, 05:52 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

This is the same problem as this one: http://www.basic4ppc.com/forum/quest...n-problem.html
DrawBackgroundImage2 disposes the image after drawing it on the GameWindow.

The solution is to create a new copy of the image (with a Bitmap object) and then pass it.
It will be fixed in the next update of the Sprite library.

BTW, why are you setting ForeLayer to true? It is hidden by the GameWindow.
There is a problem with the designer code in your source file.
You can use the attached file instead.
Reply With Quote
  #8 (permalink)  
Old 06-16-2008, 06:04 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Default

Hi all.

Yep i suppose that image was disposing after drawimage. The code was only a draft playing around with forms and gamewindows (I have to learn a lot yet!).

Thanks a lot for improve the code!!

Klaus thanks to you too for your interest and help!!

Best Regards, fjsantos.
________
weed news

Last edited by fjsantos : 01-24-2011 at 10:40 PM.
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
i lost treeview.dll after loading V6 dan kabestan Questions (Windows Mobile) 1 01-03-2008 11:57 AM
Performance on Bitmap? Roadrunner Questions (Windows Mobile) 9 12-09-2007 02:19 PM
Background-Color on Bitmap.new2 Roadrunner Bug Reports 1 12-08-2007 03:08 PM
Out of Memory error while loading bitmap HARRY Questions (Windows Mobile) 3 05-15-2007 12:12 PM
Image gets lost with orientation change HARRY Questions (Windows Mobile) 7 05-14-2007 09:19 AM


All times are GMT. The time now is 09:49 AM.


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