It is currently Mon May 01, 2017 3:44 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Alpha blending on canvas - very simple
PostPosted: Fri Apr 21, 2017 9:26 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Mar 02, 2013 9:17 am
Posts: 421
Alpha blending on canvas !

Primary it's very simple for output all things with alpha blending also on canvas :wink:

This simple method you can use also as base for image or animated GIF output with invisible color, with or without alpha blending and animations

Code:
If OpenWindow(1, 0, 0, 500, 500, "Alpha blending on canvas - Example", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget) And CanvasGadget(1, 0, 0, 499, 499)
 
  temporary_image=CreateImage(#PB_Any, GadgetWidth(1)-1, GadgetHeight(1)-1)
 
  StartDrawing(ImageOutput(temporary_image))
  Box(50, 50, 400, 400, -1)
  Box(100, 100, 200, 200, $FF)
 
  DrawingMode(#PB_2DDrawing_AlphaBlend)
  Box(200, 200, 200, 200, $FFFF | $AA000000)
  StopDrawing()
 
  SetGadgetAttribute(1, #PB_Canvas_Image, ImageID(temporary_image))

  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

_________________
http://www.nachtoptik.de
BucketFill advanced -GFX FOR IMAGES & CANVAS: http://www.purebasic.fr/english/viewtopic.php?f=12&t=66927
QUICK-AES-256 -SUITE & DLL/SO & RSA: http://www.purebasic.fr/english/viewtopic.php?f=27&t=60507


Last edited by walbus on Fri Apr 21, 2017 1:51 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Alpha blending on canvas - very simple
PostPosted: Fri Apr 21, 2017 12:07 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 308
Location: Linz, Austria
And what's so special about this code that it deserves a Tricks 'n' Tips entry? :?


Top
 Profile  
Reply with quote  
 Post subject: Re: Alpha blending on canvas - very simple
PostPosted: Fri Apr 21, 2017 12:35 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Mar 02, 2013 9:17 am
Posts: 421
Nothing !

I think we should giving also beginners tricks n' tips :wink:

_________________
http://www.nachtoptik.de
BucketFill advanced -GFX FOR IMAGES & CANVAS: http://www.purebasic.fr/english/viewtopic.php?f=12&t=66927
QUICK-AES-256 -SUITE & DLL/SO & RSA: http://www.purebasic.fr/english/viewtopic.php?f=27&t=60507


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: No registered users and 6 guests


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