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

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

Basic4ppc Wishlist Missing any feature?

Drawing on image control

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2008, 07:08 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Drawing on image control

Erel
All the drawing commands like circle, line are limited to drawing on forms.
It will be useful to have them work on controls.
Thanks.
David
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-15-2008 at 07:17 PM.
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 05:01 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You could draw on image controls (and ImageButtons) with the ImageLib library.
Draw on a bitmap and set the bitmap to be the control's image.
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 10:42 AM
Senior Member
 
Join Date: Jul 2007
Location: Michigan Usa
Posts: 176
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Erel, I know I understand what your saying but I'm not sure I understand how to implement it. Could you post a tiny example. Thanks in advance for your help.

__________________
Using 6.90
dennishea
Reply With Quote
  #4 (permalink)  
Old 01-16-2008, 10:50 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Example is attached.
Attached Files
File Type: zip DrawOnImage.zip (4.0 KB, 124 views)
Reply With Quote
  #5 (permalink)  
Old 01-16-2008, 11:09 AM
Senior Member
 
Join Date: Jul 2007
Location: Michigan Usa
Posts: 176
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Many Thanks Erel

__________________
Using 6.90
dennishea
Reply With Quote
  #6 (permalink)  
Old 01-16-2008, 11:39 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default drawing on control

Erel
I do it with the use of dzimage.dll :
I draw on another form and then copy the part I need to the image control.
I just thought it can save some time and code.

example:

north_arrow(15,37,-rtrack)
form6.Circle(15,37,12,Rgb(255,255,255),f)
form6.Polygon(alX,0,alY,0,4,cBlack,f)
compass.Image = img.CopyImage(form6.Image,3,25,25,25)
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #7 (permalink)  
Old 01-16-2008, 12:10 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,461
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hello Erel,
could the polygon function and the circle function, which exists for forms, also be added to the Drawer object so we have all the drawing functions in one object ?
Otherwise if I want to draw a filled ellipse I have to use the Drawer function and if I want to add a filled polygon I must do it on the form and then combine both images.

Best regards
Klaus
Switzerland
Reply With Quote
  #8 (permalink)  
Old 01-16-2008, 12:15 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

FillEllipse / DrawEllipse are suitable for circles too (when the rectangle is also a square).
Polygon will be added to the drawer functionality.
Reply With Quote
  #9 (permalink)  
Old 01-16-2008, 02:53 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,461
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Thank's Erel
I know that the circle is a particular case of an ellipse.
But from the drawing point of view:
- the circle is defined by it's center coordinates and the radius
- the ellipse is defined by it's outer rectangle
So why not include both ?

Best regards
Klaus
Reply With Quote
  #10 (permalink)  
Old 01-16-2008, 03:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I see your point and will consider it.

Generally speaking in order to keep the language simple I prefer not to overload it with almost duplicated functions.
You can also achieve it with:
Code:
Sub DrawCircle(drawerObject,x,y,r,color,fill)
    
rect.New1(x-r,y-r,2*r,2*r)
    
If fill Then
        brush.Color = color
        Control(drawerObject,Drawer).FillEllipse(brush.Value,
rect.Value)
    
Else
        pen.Color = color
        Control(drawerObject,Drawer).DrawEllipse(pen.Value,
rect.Value)
    
End If
    Control(drawerObject,Drawer).Refresh2(
rect.Value)
End Sub

Calling this 
sub:
DrawCircle (
"drawer1",100,100,30,cRed,True)
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
Drawing a Image bigger then the screen Georg Questions (Windows Mobile) 16 06-06-2008 04:36 PM
draw line into image control giannimaione Questions (Windows Mobile) 4 06-03-2008 04:40 PM
Control IMAGE Joserra Spanish Forum 5 11-14-2007 05:58 PM
Drawing parts of a large image. Erel Code Samples & Tips 0 06-07-2007 08:07 AM
Move an image inside an image control Cableguy Questions (Windows Mobile) 5 05-14-2007 07:40 PM


All times are GMT. The time now is 11:04 AM.


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