Vector Drawing. User Applied ID for Layer

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Vector Drawing. User Applied ID for Layer

Post by IdeasVacuum »

If Vector Layers could be given ID's, that would lend greater flexibility.
It would be very useful to be able to Show/Hide layers individually and to Delete Layers.

This capability is common in the world of drawing.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Vector Drawing. User Applied ID for Layer

Post by freak »

The EndVectorLayer() command draws the finished layer on the layer below. The layer stops existing after that. You can't modify it later.
quidquid Latine dictum sit altum videtur
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Vector Drawing. User Applied ID for Layer

Post by IdeasVacuum »

... I'm aware of that Freak, hence my request.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Vector Drawing. User Applied ID for Layer

Post by collectordave »

I remember needing something like this as well.

I started by creating transparent images for each layer I needed.

Layer 0 was always used to draw on then when the drawing was finished Image(0) was copied to the current layer image.

Then updating the drawing on the canvas by drawing each enabled layer image onto the canvas.

I will look for my code but hope this helps.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Vector Drawing. User Applied ID for Layer

Post by collectordave »

Well I have found my notes.

Each layer was an image with a transparent background.

I stored the paths along with colour, stroke and layer number etc in a structured list

You get the paths with Pathsegments()

When loading, each layer is drawn first then they can all be combined into one image on a canvas.

Each layer can be turned on or off and transparency set for each layer.

Hoping my code is not on the my crashed PC.

Will keep looking.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply