DrawAlphaImage bug !? [Pb 5.30]

Post bugreports for the Windows version here
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

DrawAlphaImage bug !? [Pb 5.30]

Post by dobro »

windows seven 64 compil 32 Nvidia GTX 570M

In this code, you load 2 images (jpg or png)
it places them side by side in larger image

if line 49, transparency is less to 255
both images we can see

if transparency = 255, we can not see anything !!
----------------------------------------------------
dans ce code , on charge 2 images (png or jpg)
on les places cote a cote, dans une image plus grande

si ,ligne 49 , la transparence est inferieur a 255
on voit bien les deux images

si la transparence = 255 , on ne vois plus rien !!

Code: Select all

;***********************************************
;Titre  :*test
;Auteur  : Dobro
;Date  :18/06/2015
;Heure  :09:48:15
;Version Purebasic :  PureBasic 5.30 (Windows - x86)
;Version de l'editeur :EPB V2.58
; Libairies necessaire : Aucune 
;***********************************************

UsePNGImageDecoder()
UseJPEGImageDecoder()

Enumeration
	#win
	#Scroll
	#nav
	#image_receptacle
	#image_1
	#image_2
EndEnumeration




; load 2 images for the test
File$=OpenFileRequester("load  picture 1" ,"c:\","Pictures|*.png;*.jpg",1)
if LoadImage(#image_1,File$)<>0
	Else
	MessageRequester("info","dont load image 1")
	End
Endif

File$=OpenFileRequester("load  picture 2" ,"c:\","*.png",1)
if LoadImage(#image_2,File$)<>0
	Else
	MessageRequester("info","dont load image 2")
	End
Endif
ResizeImage(#image_1,1024,768)
ResizeImage(#image_2,1024,768)


; Creation de l'image qui va recevoir les 2 autres ( 2048 car 1024 x2 ) .. on va les mettres l'une a coté de l'autre 
CreateImage(#image_receptacle,2048,768,32,#PB_Image_Transparent )


; ************ here the Bug  *******************************
transparence=253  ; if transparance<255 it work !!  but if transparance=255 no dispay   !!!! <-------------------------------------------------------------- HERE
StartDrawing(ImageOutput(#image_receptacle))
	DrawAlphaImage(ImageId(#image_1),0,0,transparence) ; display image on left
	DrawAlphaImage(ImageId(#image_2),1024,0,transparence) ; display image on right
StopDrawing()
; ********************************************************


If OpenWindow(#win,0,0,1024,768,"Aspi_Map",#PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
	ScrollAreaGadget(#Scroll, 10, 10, 1024,768, 1024, 768, 30)
	
	SetGadgetAttribute(#scroll, #PB_ScrollArea_InnerWidth , 2048) ; resize Scroll Area
	SetGadgetAttribute(#scroll,#PB_ScrollArea_X,512): 
	ImageGadget(#nav,10,10,600,600,ImageId(#image_receptacle)) ; display result
	CloseGadgetList() 
	
	Repeat 
	Until WaitWindowEvent(2) = #PB_Event_CloseWindow
EndIf
; Epb

Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
User avatar
kenmo
Addict
Addict
Posts: 2043
Joined: Tue Dec 23, 2003 3:54 am

Re: DrawAlphaImage bug !? [Pb 5.30]

Post by kenmo »

Confirmed on PB 5.31 + Win 7 x86, looks like a bug to me.

Observations:

1. It only seems to happen when drawing a 24-bit source image (most JPG) onto a 32-bit target (your image_receptacle). On my system, 32-bit PNG source images seem to draw correctly at alpha=255.

2. The source image is being drawn, but with all-0 alpha. You can test this by adding at the bottom of your drawing:

Code: Select all

DrawingMode(#PB_2DDrawing_AlphaChannel)
Box(0, 0, OutputWidth(), OutputHeight(), RGBA(0, 0, 0, 255))
3. Other ways to make the image appear:
- Change image background from #PB_Image_Transparent to an opaque color like #White
- Change the destination image from 32-bit to 24-bit
- Use DrawingMode #PB_2DDrawing_AllChannels or #PB_2DDrawing_AlphaBlend
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Re: DrawAlphaImage bug !? [Pb 5.30]

Post by dobro »

kenmo wrote: - Change the destination image from 32-bit to 24-bit
with 24 yes it works ... :)
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
Post Reply