PlanetSquires Forums

Support Forums => General Board => Topic started by: raymw on October 04, 2019, 12:09:31 PM

Title: CGpBrush Class
Post by: raymw on October 04, 2019, 12:09:31 PM
is the solid brush opaque?

e.g. I have code like this

pw =24
  dim solidbrush as   CGpSolidBrush = GDIP_ARGB(0, 0, 0, 255)
    DIM blackPen AS CGpPen = CGpPen(GDIP_ARGB(20, 0, 0, 0), pw)
blackpen.setlinecap(linecapround,linecapround,linecapround)
blackpen.setbrush(@solidbrush)

then in the line generating loop, I have
   'gradually darken lines from centre
     blackpen.setcolor(GDIP_ARGB(20+j, 0, 0, 0))

  graphics.DrawLine(@blackPen, x,y,x1,y1)

where the ends of the lines overlap it seems the colour is darker. (more like painting with a transparent paint (e.g. watercolour) as opposed to an opaque colour (e.g. oils))
I guess there may be another value to set, or perhaps the order of the various pen settings/brush settings need changing. (the circular dark gey blobs, and the outlining should not be there if opaque colour.)

Title: Re: CGpBrush Class
Post by: José Roca on October 04, 2019, 12:25:51 PM
To make it opaque, you must set the alpha value to 255.

See: https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-drawing-with-opaque-and-semitransparent-brushes-use
Title: Re: CGpBrush Class
Post by: raymw on October 04, 2019, 02:22:08 PM
Thanks, Jose, I should have known that... well, i did a few years back.
changing pen colour to  blackpen.setcolor(GDIP_ARGB(255,20+j,20+j,20+j))  does what I was looking for.