[Done] PBv6.02b2 Transparency with VectorDrawing

Post bugreports for the Windows version here
PeDe
Enthusiast
Enthusiast
Posts: 281
Joined: Sun Nov 26, 2017 3:13 pm

[Done] PBv6.02b2 Transparency with VectorDrawing

Post by PeDe »

Windows 7, 32 Bit, PB v6.02b2 ASM & C

The transparency is no longer present.
The icons are drawn into an image with VectorDrawing commands, and then displayed in the menu, toolbar and ListIconGadget.

The example from the help of 'CreateImageMenu()' with '.png' icons works without errors.
I have yet to create a sample code.

https://www.dreisiebner.at/temp/PBv602b ... arency.png

Peter
PeDe
Enthusiast
Enthusiast
Posts: 281
Joined: Sun Nov 26, 2017 3:13 pm

Re: [PBv6.02b2] Transparency with VectorDrawing

Post by PeDe »

I found the error. It is the PB constant '#PB_Image_Transparent' or -1.

Peter

Code: Select all

Debug "#PB_Image_Transparent = " + #PB_Image_Transparent

; PB v6.02.b2
; Executable type: Windows - x86  (32bit, Unicode, Thread, Purifier)
; [Debug] #PB_Image_Transparent = 8589934592

; <= PB v6.02b1
; Executable type: Windows - x86  (32bit, Unicode, Thread, Purifier)
; [Debug] #PB_Image_Transparent = -1
Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PBv6.02b2] Transparency with VectorDrawing

Post by Fred »

Yes, we changed the constant value, why is it an issue ?
PeDe
Enthusiast
Enthusiast
Posts: 281
Joined: Sun Nov 26, 2017 3:13 pm

Re: [PBv6.02b2] Transparency with VectorDrawing

Post by PeDe »

I have recreated the error with similar code as in the program. The parameter 'iBackColor' becomes 0, I don't know why. It works with all versions smaller than PB v6.02.b2.

Peter

Code: Select all

EnableExplicit

DeclareModule VectorIcon
	EnableExplicit
	#iStandardBackground = #PB_Image_Transparent
	Declare.i VectorIcon(iSize.i, iBackColor.i = #iStandardBackground)
EndDeclareModule

Module VectorIcon
	Procedure.i VectorIcon(iSize.i, iBackColor.i = #iStandardBackground)
		Protected iImageNumber.i
		Protected rScaleWidth.d = (iSize / 32.0)
		Protected rScaleHeight.d = (iSize / 32.0)
		
		Debug "iBackColor = " + iBackColor + "  -  #iStandardBackground = " + #iStandardBackground + "  -  #PB_Image_Transparent = " + #PB_Image_Transparent
		
		iImageNumber = CreateImage(#PB_Any, iSize, iSize, 32, iBackColor)
		If StartVectorDrawing(ImageVectorOutput(iImageNumber, #PB_Unit_Pixel))
			ScaleCoordinates(rScaleWidth, rScaleHeight)
			
			; CorelDraw CurveShape.Curve.
			; SubPath 1 of 2.
			MovePathCursor(18.9, 6.37)
			AddPathLine(16.99, 2)
			AddPathLine(15, 2)
			AddPathLine(13.09, 6.38)
			AddPathLine(11.24, 7.14)
			AddPathLine(6.8, 5.4)
			AddPathLine(5.39, 6.81)
			AddPathLine(7.14, 11.25)
			AddPathLine(6.37, 13.1)
			AddPathLine(2, 15.01)
			AddPathLine(2, 17)
			AddPathLine(6.38, 18.91)
			AddPathLine(7.14, 20.76)
			AddPathLine(5.4, 25.2)
			AddPathLine(6.81, 26.61)
			AddPathLine(11.25, 24.86)
			AddPathLine(13.1, 25.62)
			AddPathLine(15.01, 30)
			AddPathLine(17, 30)
			AddPathLine(18.91, 25.62)
			AddPathLine(20.76, 24.86)
			AddPathLine(25.2, 26.6)
			AddPathLine(26.61, 25.19)
			AddPathLine(24.86, 20.75)
			AddPathLine(25.62, 18.9)
			AddPathLine(30, 16.99)
			AddPathLine(30, 15)
			AddPathLine(25.62, 13.09)
			AddPathLine(24.86, 11.24)
			AddPathLine(26.6, 6.8)
			AddPathLine(25.19, 5.39)
			AddPathLine(20.75, 7.14)
			AddPathLine(18.9, 6.37)
			; SubPath 2 of 2.
			MovePathCursor(15.99, 11)
			AddPathCurve(18.76, 11, 20.99, 13.23, 20.99, 15.99)
			AddPathCurve(20.99, 18.76, 18.76, 20.99, 15.99, 20.99)
			AddPathCurve(13.23, 20.99, 11, 18.76, 11, 15.99)
			AddPathCurve(11, 13.23, 13.23, 11, 15.99, 11)
			VectorSourceColor($FF0000FF)
			FillPath(#PB_Path_Preserve)
			ResetPath()
			
			StopVectorDrawing()
		EndIf
		ProcedureReturn iImageNumber
	EndProcedure
EndModule

Procedure Main()
	Protected iWindow.i, iMenu.i, iToolbar.i, iStatusBar.i, iImage.i, iSize.i
	
	iWindow = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 400, 300, "Test")
	
	iMenu = CreateImageMenu(#PB_Any, WindowID(iWindow))
	MenuTitle("File")
	MenuItem(1, "#iStandardBackground", ImageID(VectorIcon::VectorIcon(16, VectorIcon::#iStandardBackground))) ; ?????
	MenuItem(2, "#PB_Image_Transparent", ImageID(VectorIcon::VectorIcon(16, #PB_Image_Transparent))) ; ?????
	MenuItem(3, "Default", ImageID(VectorIcon::VectorIcon(16))) ; Use default optional parameter. ; ?????

	iToolbar = CreateToolBar(#PB_Any, WindowID(iWindow), #PB_ToolBar_Small)
	iImage = VectorIcon::VectorIcon(16) ; Use default optional parameter. ; ?????
	ToolBarImageButton(1, ImageID(iImage), #PB_ToolBar_Normal)
	FreeImage(iImage)

	Repeat : Until (WaitWindowEvent() = #PB_Event_CloseWindow)
		
EndProcedure

Main()
Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PBv6.02b2] Transparency with VectorDrawing

Post by Fred »

I think I know why, the transparent constant is now a quad, so an integer isnt enough to store it if you use x86 version. I will probably revert this fix for now and change this behavior for 6.10 to solve the issue
PeDe
Enthusiast
Enthusiast
Posts: 281
Joined: Sun Nov 26, 2017 3:13 pm

Re: [PBv6.02b2] Transparency with VectorDrawing

Post by PeDe »

Yes, if I change the parameter 'iBackColor' to a Quad, then it works again.

Peter
Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Done] PBv6.02b2 Transparency with VectorDrawing

Post by Fred »

Fixed. The behaviour: when creating a 32 bit image has been changed: the specified color is full RGBA()
Post Reply