[Gambas-devel] [Gambas-devel-svn] SF.net SVN: gambas: gambas/trunk/main/lib/data
tobias at ...692...
Sat Jul 12 02:30:58 CEST 2014
On Sat, 12 Jul 2014, tobiasboe at ...1... wrote:
> Revision: 6372
> Author: tobiasboe
> Date: 2014-07-12 00:20:35 +0000 (Sat, 12 Jul 2014)
> Log Message:
> * NEW: First attempt to define a Graph class interface
@Benoit: I haven't read the Paint/Image classes yet you proposed. I thought
maybe I should just commit to let you see what I did.
The virtual classes approach works by:
(1) Define a virtual class property to mean something, like Graph.Vertices,
virtual of type .Graph.Vertices to enumerate vertices.
(2) In .Graph.Vertices, define _next() to call a hidden method
_nextVertex() which is implemented in the real Graph class.
This minimises the amount of classes one has to write because everything can
get into Graph or the _Graph_Vertex class (we have a total of 5 enumerable
classes merged this way into these both classes).
I attach a project which implements a Graph over an Image object which can
be flood-filled by the BFS algorithm. The interesting source files would be
In the GUI, you have a minimal ColorChooser type of control on the right
side. Just select a color and then click on the Image to start the flood-
fill at the pixel you pointed to.
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7721 bytes
Desc: not available
More information about the Devel