It is currently Sat Nov 25, 2017 2:58 am

All times are UTC + 1 hour

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [4.51] Different output window vs. image
PostPosted: Tue Feb 08, 2011 8:10 pm 
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7389
Location: Norway
The blending mode used on images and windows is different, even when both outputs use #PB_2dDrawing_Default. To get the same behaviour the drawing mode of the window must be #PB_2dDrawing_Default and the mode of the image must be #PB_2dDrawing_AlphaBlend!

Procedure MakePieceImage()
  Protected Font, Img
  Font = LoadFont(#PB_Any, "Sans", 25)
  Img = CreateImage(#PB_Any, 100, 100, 32 | #PB_Image_Transparent)
    DrawingMode(#PB_2DDrawing_AllChannels | #PB_2DDrawing_Transparent)
    PcsColor = RGBA(255, 0, 255, 255)
    DrawText(4, 1, "text", PcsColor)
  ProcedureReturn Img

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
SetWindowColor(0, RGB(255, 255, 0))
i = MakePieceImage()
ImageGadget(0, 10, 10, 0, 0, ImageID(i))

CreateImage(0, 110, 110, 24)
  DrawImage(ImageID(i), 10, 10)
ImageGadget(1, 150, 10, 0, 0, ImageID(0))

  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Repaint
        DrawImage(ImageID(i), 10, 200)
    Case #PB_Event_Gadget
      Select EventGadget()
    Case #PB_Event_Menu
      Select EventMenu()
Until Event = #PB_Event_CloseWindow

Reply with quote  
 Post subject: Re: [4.51] Different output window vs. image
PostPosted: Tue Oct 31, 2017 7:26 pm 
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5746
Location: Germany
A number of backends (including WindowOutput on Linux) cannot ignore the alphachannel when drawing images. So DrawImage() is equal to DrawAlphaImage() there. If you want consistent results, just use DrawAlphaImage() which should produce the same output on all backends.

Maybe a note can be added about this in the documentation.

quidquid Latine dictum sit altum videtur

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

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users 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