[Gambas-user] painting graph to image continuously
wally
wally at ...2037...
Thu Dec 16 10:21:16 CET 2010
On Wednesday 15 December 2010 18:57:16 Fabien Bodard wrote:
> Le 15 décembre 2010 16:56, Benoît Minisini
> <gambas at ...1...> a écrit :
> >>
> >> thanks :) but ... Image , "Not a drawable Object"
> >>
> >> If t > myImage1.W Then
> >> myImage1.Resize(myImage1.w + 1, myImage1.H)
> >>
> >> Draw.Begin(myImage1) <--- Image , "Not a drawable Object"
> >> Draw.FillRect(myImage1.W - 1, 0, 1, myImage1.H, Color.RGB(255, 255,
> >> 223)) Draw.End
> >>
> >
> > Yes, I forgot that only Paint can be used on images... So you have to use
> > Paint!
> >
> > --
> > Benoît Minisini
> >
> >
------------------------------------------------------------------------------
> > Lotusphere 2011
> > Register now for Lotusphere 2011 and learn how
> > to connect the dots, take your collaborative environment
> > to the next level, and enter the era of Social Business.
> > http://p.sf.net/sfu/lotusphere-d2d
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> or a drawing area ...
>
> --
> Fabien Bodard
>
>
------------------------------------------------------------------------------
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
Fabian, Benoit,
i tied your suggestion too and it's true i can apply "Draw" and "Paint"
to DrawingArea, but doing so, i get more problems.
I attached code and screenshot for better reading
DraawingArea.Cache = TRUE
1st Problem is that after the first resize operation the former Drawing is
repeated. So i get several identical graphs in sequence.
2nd Problem is that
Draw.FillRect(DrawingArea1.W - 1, 0, 1, DrawingArea1.H, Color.Cyan)
is ignored , same as the paint instructions after 1st resize.
3rd Problem is the screenshot, you can see this in attachment.
How to do this all as needed and how to save a copy of the entire graph ?
thanks wally
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dArea.png
Type: image/png
Size: 17242 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20101216/b9a648ce/attachment.png>
-------------- next part --------------
Public Sub btn_DArea_Click()
Dim t As Integer
Dim y As Integer
For t = 0 To 1000
If (t Mod 25 = 0) Then
y = CInt(Rnd(0, 128))
Endif
If t > DrawingArea1.W Then
DrawingArea1.Resize(DrawingArea1.W + 1, DrawingArea1.H)
Draw.Begin(DrawingArea1)
Draw.FillRect(DrawingArea1.W - 1, 0, 1, DrawingArea1.H, Color.Cyan) 'DrawingArea1.Background)
Draw.End
Endif
Paint.Begin((DrawingArea1))
Paint.Brush = Paint.Color(Color.RGB(255, 0, 0))
Paint.LineWidth = 1
Paint.MoveTo(last_t, last_y)
Paint.LineTo(t, y)
Paint.Stroke
Paint.End
ScrollView3.EnsureVisible(t, 64, 50, 50)
Wait 0.05
last_t = t
last_y = y
Next
myPicture = DrawingArea1.Screenshot()
myPicture.Save(ProjPath &/ "dArea.png")
End
More information about the User
mailing list