sdl.test
Class TestAlpha

java.lang.Object
  |
  +--sdl.test.TestAlpha

public class TestAlpha
extends java.lang.Object

Demo of alpha blending with JSDL.

  SDLSurface screen = null;
  SDLSurface image = null;
  SDLSurface background=null;
						                

   screen = video.setVideoMode(640,200,16,Video.SDL_SWSURFACE);

   background = new SDLSurface(BG_FILE);
   image = new SDLSurface(FG_IMAGE_FILE);


   // Draw  the background image to the screen

   SDLRect src = new SDLRect(0,0,background.m_Width,background.m_Height);
   SDLRect dest = new SDLRect(0,0,background.m_Width,background.m_Height);

   background.blitSurface(src,screen,dest);

   // Draw the foreground image without a colorkey. 

   src = new SDLRect(0,0,image.m_Width,image.m_Height);
   dest = new SDLRect(30,90,image.m_Width,image.m_Height);
   
   image.blitSurface(src,screen,dest);

   // Draw it again with alpha blending

   image.setAlpha(Video.SDL_SRCALPHA,(byte)128);

   src = new SDLRect(0,0,image.m_Width,image.m_Height);
   dest = new SDLRect(screen.m_Width - image.m_Width - 30,90,image.m_Width,image.m_Height);

   image.blitSurface(src,screen,dest);

   screen.updateRect(0,0,0,0);

   


Constructor Summary
TestAlpha()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestAlpha

public TestAlpha()
Method Detail

main

public static void main(java.lang.String[] args)