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.

Capture basic drawings?

Reply
 
LinkBack Thread Tools Display Modes
  #41 (permalink)  
Old 02-22-2009, 09:34 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 derez View Post
have no problem to over-write the same file again and again.
That's a different scenario. You are drawing a screen capture so the Bitmap has no file associated with it. He is editing a Bitmap loaded from a file and the locking of that source file by .NET for the lifetime of that Bitmap is what is causing his problem of not being able to overwrite the file.

See here http://www.basic4ppc.com/forum/addit...html#post22625
Reply With Quote
  #42 (permalink)  
Old 02-22-2009, 11:04 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Andrew
You are right, thanks for the explanation.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #43 (permalink)  
Old 02-22-2009, 11:51 AM
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

Hi tstewart,

Yesterday I wasn't at home, so I answer you only today.


Quote:
I didn't expect you to do that.
Me too !
But I needed to test if the 'prcedure' I described worked, also for my own knowledge. The best way to test something is with a real example, so I did it.

Quote:
I sorry, I'll stop pestering you soon, I promise.
Don't worry, if I can I help I do it with pleasure.

Quote:
I now wish to pass the image to be displayed from the main program.
For the image file pass:
- Do you need to pass the file name from the main module to the Draw module, or wouldn't a Load button in the Draw module do it, of course both are also possible.
- When you load a new image, you must initialize once again the drawer and the font. If the size is different you also need to initialize the Scroll contol properties, at least Maximum and Value.

Quote:
How about adding an undo feature.
I would not save the whole image, but only either:
- the surrounding rectangles of the last drawings with their dimensions Left, Top, Width and Height, it needs to calculate the surrounding rectangle's dimensions in function of the drawing function type, line width etc. This would use the less memory.
- the whole screen (the current displayed part of the image) with the ScreenX0 and ScreenY0 coordinates (upper left corner of the displayed part in the whole image), easier to implement but needs some more memory.

Save in memory or in files:
- in memory, would be faster but with the risc of 'out of memory' error
- in files, no out of memory risc but slower.

For the first solution above, I think it would be possible in memory. With the whole screen you should make some trials.

Be also aware that when you save the image with the jpg format you loose some information when reading it back. I had problems when I saved button images, as jpg's, with a white background as transparent color . When I read those back the white background looked white but wasn't real white any more and no more transparent. So I save those always as bmp's.

For the other points you already got answers.
I used the Save function in agraham's ImageLibEx library for three reasons:
- the bitmaps are saved 'normaly', bitmaps saved with dzImage library are shown upside-down in some programs.
- one library for drawing and saving
- the ImageLibEx library is directly embedded into the exe file, so no need to distribute it or save it with the exe file.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide

Last edited by klaus : 02-22-2009 at 12:08 PM.
Reply With Quote
  #44 (permalink)  
Old 02-23-2009, 08:48 AM
Basic4ppc Veteran
 
Join Date: Apr 2008
Location: Gosford NSW Australia
Posts: 223
Send a message via MSN to tsteward
Default

Attached is my mod of your program Klaus.
If you open and edit an image it, I can now save it by saving to a temp file, then disposing some items and copying the file to the original.

BUT

I cant edit the image a second time. I don't realy understand the disposing stuff. I thought I could dispose every thing created with new and then re-rin the init routine next time through. It doen't work.

Can anyone show me how I might re-edit the image.

Ie run the program. Click the button, loads the image, edit it and click save. thenclick button to load and edit image again.

Thanks
Tony
__________________
PC: Dual core 3.4ghz 2gb ram
PPC: I-mate Jasjam
Reply With Quote
  #45 (permalink)  
Old 02-23-2009, 02:23 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

Here you are, I finaly got it.
I post only the sbp and bas files.

I solved the save problem with a dummy bitmap that way:
Code:
<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">AddObject</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"bmpDummy"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"BitmapEx"</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">bmpDummy.New3(bmpImage.Value)</font></font>
<font size=
"2"><font face="Courier New">bmpImage.Dispose</font></font>
<font size=
"2"><font face="Courier New">drwImage.Dispose</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">Select</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> SaveFormat</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">Case</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"JPG"</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2"> bmpDummy.SaveImage(</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">AppPath</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"\RoseText.jpg"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"J"</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="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Case</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"BMP"</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2"> bmpDummy.SaveImage(</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">AppPath</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"\RoseText.bmp"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"B"</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="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Case</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"GIF"</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2"> bmpDummy.SaveImage(</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">AppPath</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"\RoseText.gif"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"G"</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="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Case</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"PNG"</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2"> bmpDummy.SaveImage(</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">AppPath</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"\RoseText.png"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"P"</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="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End</font></font></font></font></font></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">Select</font></font></font>
</font></font></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">AddObject</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"bmpImage"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"BitmapEx"</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="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">AddObject</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"drwImage"</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="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"DrawerEx"</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">bmpImage.New3(bmpDummy.Value)</font></font>
<font size=
"2"><font face="Courier New">drwImage.New2(bmpImage.Value)</font></font>
<font size=
"2"><font face="Courier New">bmpDummy.Dispose</font></font>
</font></font>
That way the bitmap remains available because copying the bitmap to bmpDummy and disposing bmpImage, saving bmpDummy to the file, and copying bmpDummy back to a new initialized bmpImage. As drwImage is connected to bmpImage it must also be disposed and initialized again.

Best regards.
Attached Files
File Type: sbp MyDrawer.sbp (558 Bytes, 16 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #46 (permalink)  
Old 02-24-2009, 05:56 AM
Basic4ppc Veteran
 
Join Date: Apr 2008
Location: Gosford NSW Australia
Posts: 223
Send a message via MSN to tsteward
Default

Very close BUT scroll bars do not scroll image on second load if image.
__________________
PC: Dual core 3.4ghz 2gb ram
PPC: I-mate Jasjam
Reply With Quote
  #47 (permalink)  
Old 02-24-2009, 07:56 AM
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

Here is the last version.

Best regards.
Attached Files
File Type: bas mdlDraw.bas (16.4 KB, 11 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #48 (permalink)  
Old 02-24-2009, 08:40 AM
Basic4ppc Veteran
 
Join Date: Apr 2008
Location: Gosford NSW Australia
Posts: 223
Send a message via MSN to tsteward
Default

Thats great thanks mate!
__________________
PC: Dual core 3.4ghz 2gb ram
PPC: I-mate Jasjam
Reply With Quote
  #49 (permalink)  
Old 02-27-2009, 09:22 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

Hi tsteward,

There is a new evolution of the program here.
http://www.basic4ppc.com/forum/share...html#post22832

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
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
Desktop Videocam image capture library agraham Additional Libraries 22 03-18-2012 10:42 AM
Screen Capture App sahoopes Share Your Creations 5 10-06-2011 07:22 AM
Signature capture and label autosize ohkovar Questions (Windows Mobile) 10 02-06-2010 09:30 AM
Capture name of control that has focus aerohost Questions (Windows Mobile) 5 06-21-2008 10:31 PM
Trial Basic colin9876 Questions (Windows Mobile) 8 11-15-2007 10:35 PM


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


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