ScreenOutput and 32-Bit Colors

Post bugreports for the Windows version here
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

ScreenOutput and 32-Bit Colors

Post by STARGÅTE »

if a color have the alpha value 255, the color dont drawed:

Code: Select all

InitSprite()

UsePNGImageDecoder()

Enumeration
	#Window
EndEnumeration

OpenWindow(#Window, 0, 0, 800, 600, "ScreenTitle", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)

Repeat
	
	ClearScreen(0)
	
	If StartDrawing(ScreenOutput())
		Box(100, 100, 600, 100, $FF00FF00)
		Box(100, 250, 600, 100, $C000FF00)
		Box(100, 400, 600, 100, $0000FF00)
		StopDrawing()
	EndIf
	
	FlipBuffers()
	
Until WindowEvent() = #PB_Event_CloseWindow
I don't want the alpha blend!
But all 32-Bit colors should be drawed as 24 bit color with full alpha, but the first box is invisible.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: ScreenOutput and 32-Bit Colors

Post by kenmo »

Confirmed on Windows 7 x86...

Changing the alpha to anything else, such as $FE, seems to appear. Using RGBA() has the same results, but that makes sense since it should generate the same 32-bit value.
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: ScreenOutput and 32-Bit Colors

Post by leonhardt »

confirmed on Win7 32bit , pb4.61

Code: Select all

InitSprite()
Enumeration
  #Window
EndEnumeration

OpenWindow(#Window, 0, 0, 800, 600, "ScreenTitle", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)
Repeat
 
  ClearScreen(0) 
  StartDrawing(ScreenOutput())
    Box(100, 100, 200, 100, RGBA($FF,$F2,$12,$FF))
    Circle(200,200,200,RGBA($FF,$F2,$12,$FF))
  StopDrawing()
  FlipBuffers()
  
Until WindowEvent() = #PB_Event_CloseWindow

In my opinion ,this is not a bug ,the RGBA() function is used mainly for ImageOutPut() by Box() etc,rather than ScreenOutPut(), how to use it is decided by the user not by the function itself...you can view the help file,DrawingMode() function,"Note: The following modes only work with ImageOutput(). They are ignored for all other outputs:

#PB_2DDrawing_AlphaBlend
The drawing operations will be alpha-blended onto the background. The RGBA() command can be used to specify colors with alpha transparency in commands like FrontColor(), Box(), DrawText() etc.
#PB_2DDrawing_AlphaClip
The drawing operations will be alpha-blended onto the background like with the #PB_2DDrawing_AlphaBlend mode, with the addition that the alpha channel of the drawing output acts as a mask. This means that areas of the output that are transparent before the blending will also remain transparent afterwards. If the drawing output has no alpha channel then this mode acts just like the #PB_2DDrawing_AlphaBlend mode.
#PB_2DDrawing_AlphaChannel
The drawing operations will only modify the alpha channel of the drawing output. All color information is ignored. For example drawing a circle with a color value of RGBA(0, 0, 0, 0) will "cut" a hole into the drawing output by making the circle area fully transparent. If the drawing output has no alpha channel then no drawing will have an effect in this mode.
".......
poor English...

PureBasic & Delphi & VBA
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: ScreenOutput and 32-Bit Colors

Post by STARGÅTE »

i don't want, that Box(100, 250, 600, 100, $C000FF00) make me a transparent box on the screen.
I want only, that the functions ignore the last 8 Bits for alpha, if they don't can use it.
But you see in the example, it will be not ignore, it is misunderstood.

In my programs i use everywhere full 32-Bit colors, so that drawing on a image with alpha works too.
So I must ignore the alpha channel by myself with: Color & $00FFFFFF
But it would be nice if that's the function itself.

For example, if i write in the memory a 32-bit color with any alpha value, it works:

Code: Select all

InitSprite()

UsePNGImageDecoder()

Enumeration
   #Window
EndEnumeration

OpenWindow(#Window, 0, 0, 800, 600, "ScreenTitle", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)

Repeat
   
   ClearScreen(0)
   
   If StartDrawing(ScreenOutput())
      *Buffer = DrawingBuffer()
      Pitch = DrawingBufferPitch()
      For Y = 0 To 99
      	For X = 0 To 255
      		PokeL(*Buffer+X*4, RGBA(0,255,0,X))
      	Next
      	*Buffer + Pitch
      Next
      StopDrawing()
   EndIf
   
   FlipBuffers()
   
Until WindowEvent() = #PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply