Vector drawing clear image to transparent

Just starting out? Need help? Post your questions and find answers here.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Vector drawing clear image to transparent

Post by collectordave »

Is it possible to clear an image to transparent using the vector drawing commands?

I start with a transparent image add a box then try to clear the image but the box remains.

the code I am using:

Code: Select all

StartVectorDrawing(ImageVectorOutput(DrawImg))

	VectorSourceColor(RGBA(255,255,255,0))
	FillVectorOutput()

 AddPathBox(0,50,50,50)
  VectorSourceColor(#DrawOpaque|#DarkGray)

  FillPath()

	
	StopVectorDrawing()
	
If I set the Alpha channel to 255 it works correctly but is of Course white

A little more digging and found that Vector drawing always blends but found this:

Code: Select all

StartDrawing(ImageOutput(DrawImg))
    DrawingMode(#PB_2DDrawing_AlphaChannel )
    Box(0, 0, 200, 200, RGBA(0,0,0,0))
 StopDrawing()
 
Using this 2d drawing inside the vector drawing loop works fine.
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.