It is currently Thu Feb 20, 2020 2:51 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Done] Win XP image problems
PostPosted: Sun Nov 24, 2013 4:09 am 
Offline
User
User

Joined: Sat Nov 12, 2011 7:21 pm
Posts: 59
The example below demonstrates 4 different bugs.

1. Drawing on sprites destroys the alpha channel under directX 9. (This is already mentioned in the forum)
Visible in the upper left corner.
Drawing on an image and drawing that on the screen does work properly (upper right corner)
Using this image to draw on a sprite can be used as a work-around to this. (lower left corner)

2. GrabDrawingImage() gets the image upside down if grabbing from a sprite instead of the screenoutput(). This does not happen under Linux. DirectX 11 systems might work properly too.

3. SaveImage(ImageID_3,"upside.png",#PB_ImagePlugin_PNG) The image is grabbed correctly from the screen, but saving with the png encoder creates a broken file under Win XP for me. Works fine under Ubuntu 12.04 x64.
SaveSprite() does work properly under both systems for me.

4. SaveImage(ImageID_3,"upside.bmp") Image export in bmp format does simply nothing - the file is not created/touched at all. This happens under both Win. XP and ubuntu.

Code:
MainWindowID = OpenWindow(#PB_Any, 0, 0, 800, 600, "Image test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
If Not InitSprite()
  End
EndIf
If Not OpenWindowedScreen(WindowID(MainWindowID), 0, 0, 800, 600, #True, 0, 0, #PB_Screen_WaitSynchronization)
  End
EndIf
If Not InitKeyboard()
  End
EndIf
UsePNGImageEncoder()
UsePNGImageDecoder()

ImageID = CreateImage( #PB_Any, 200, 200, 32, #PB_Image_Transparent )

StartDrawing(ImageOutput(ImageID))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Circle(80,80,75,RGBA(0,255,0,255))
  Circle(100,100,75,RGBA(255,0,0,255))
  Circle(120,120,75,RGBA(0,0,255,255))
StopDrawing()
 
SpriteID = CreateSprite(#PB_Any, 200, 200, #PB_Sprite_AlphaBlending)

StartDrawing(SpriteOutput(SpriteID))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Circle(80,80,75,RGBA(0,255,0,255))
  Circle(100,100,75,RGBA(255,0,0,255))
  Circle(120,120,75,RGBA(0,0,255,255))
  ImageID_2 = GrabDrawingImage(#PB_Any, 0, 0, SpriteWidth(SpriteID), SpriteHeight(SpriteID))
StopDrawing()
 
SpriteID_2 = CreateSprite(#PB_Any, 200, 200, #PB_Sprite_AlphaBlending)

StartDrawing(SpriteOutput(SpriteID_2))
  DrawingMode(#PB_2DDrawing_AllChannels)
  DrawAlphaImage(ImageID(ImageID),0,0)
StopDrawing()


Repeat
 
  ClearScreen(RGB(64,64,0))
 
  DisplayTransparentSprite(SpriteID,10,10)
  DisplayTransparentSprite(SpriteID_2,10,300)
 
  StartDrawing(ScreenOutput())
  DrawAlphaImage(ImageID(ImageID),300,10)
  DrawAlphaImage(ImageID(ImageID_2),300,300)
  If Not ImageID_3
    ImageID_3 = GrabDrawingImage(#PB_Any, 0, 0, 550, 550 )
    SaveImage(ImageID_3,"upside.png",#PB_ImagePlugin_PNG)
    SaveImage(ImageID_3,"upside.bmp")
  EndIf
  StopDrawing()
 
  FlipBuffers()
 
  Event = WindowEvent()
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_All)
    Break
  EndIf
     
Until Event = #PB_Event_CloseWindow


Top
 Profile  
Reply with quote  
 Post subject: Re: Win XP image problems
PostPosted: Sun Nov 24, 2013 10:02 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8023
Location: Fort Nelson, BC, Canada
The 2 added lines addresses 1). The rest looks like bugs.
Code:

MainWindowID = OpenWindow(#PB_Any, 0, 0, 800, 600, "Image test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
If Not InitSprite()
  End
EndIf
If Not OpenWindowedScreen(WindowID(MainWindowID), 0, 0, 800, 600, #True, 0, 0, #PB_Screen_WaitSynchronization)
  End
EndIf
If Not InitKeyboard()
  End
EndIf
UsePNGImageEncoder()
UsePNGImageDecoder()

ImageID = CreateImage( #PB_Any, 200, 200, 32, #PB_Image_Transparent )

StartDrawing(ImageOutput(ImageID))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Circle(80,80,75,RGBA(0,255,0,255))
  Circle(100,100,75,RGBA(255,0,0,255))
  Circle(120,120,75,RGBA(0,0,255,255))
StopDrawing()
 
SpriteID = CreateSprite(#PB_Any, 200, 200, #PB_Sprite_AlphaBlending)

StartDrawing(SpriteOutput(SpriteID))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Box(0,0,200,200,RGBA(0,0,0,0))  ; <------------------- New line
  Circle(80,80,75,RGBA(0,255,0,255))
  Circle(100,100,75,RGBA(255,0,0,255))
  Circle(120,120,75,RGBA(0,0,255,255))
  ImageID_2 = GrabDrawingImage(#PB_Any, 0, 0, SpriteWidth(SpriteID), SpriteHeight(SpriteID))
StopDrawing()
 
SpriteID_2 = CreateSprite(#PB_Any, 200, 200, #PB_Sprite_AlphaBlending)

StartDrawing(SpriteOutput(SpriteID_2))
  DrawingMode(#PB_2DDrawing_AllChannels)
  DrawAlphaImage(ImageID(ImageID),0,0)
StopDrawing()

TransparentSpriteColor(SpriteID, RGBA(0,0,0,0))  ; <------------------- New line


Repeat
 
  ClearScreen(RGB(64,64,0))
 
  DisplayTransparentSprite(SpriteID,10,10)
  DisplayTransparentSprite(SpriteID_2,10,300)
 
  StartDrawing(ScreenOutput())
  DrawAlphaImage(ImageID(ImageID),300,10)
  DrawAlphaImage(ImageID(ImageID_2),300,300)
  If Not ImageID_3
    ImageID_3 = GrabDrawingImage(#PB_Any, 0, 0, 550, 550 )
    SaveImage(ImageID_3,"upside.png",#PB_ImagePlugin_PNG)
    SaveImage(ImageID_3,"upside.bmp")
  EndIf
  StopDrawing()
 
  FlipBuffers()
 
  Event = WindowEvent()
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_All)
    Break
  EndIf
     
Until Event = #PB_Event_CloseWindow

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Win XP image problems
PostPosted: Wed Jan 29, 2020 10:33 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13893
Location: France
Fixed.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: IdeasVacuum and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye