%
% HelloPsychophysicist.m
%
% Copyright (C) 2005-2008 Huseyin Boyaci. All Rights Reserved.
% DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
% 
% This program is free software; you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free Software
% Foundation; either version 2 of the License, or (at your option) any later
% version. This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. 
% 
% See the GNU General Public License version 2 for more details 
% (a copy is included in the LICENSE file that accompanied this code) 
% (also available at http://www.gnu.org) You should have received a copy of 
% the GNU General Public License along with this program; if not, write to 
% the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
% Boston, MA 02111-1307, USA.
% 

import psychWithJava.*;
import javax.imageio.ImageIO;
import java.io.File;

% 
% displays the text "Hello Psychophysicist (with Matlab)" 
% and two images on an otherwise entirely blank screen
%  
try
    fs = FullScreen();
    fs.setNBuffers(2);
    
    fs.blankScreen();
    fs.displayText(...
        'Hello Psychophysicist (with Matlab)');
    fs.updateScreen();
    pause(2);
    
    fs.blankScreen();
    fs.hideCursor();
    
    bi1 = im2java2d(imread('psychophysik.png','PNG'));
    fs.displayImage(bi1);
    fs.updateScreen();
    pause(2);
    
    fs.blankScreen();
    
    bi2 = ImageIO.read(File('fechner.png'));

    fs.displayImage(0,0,bi2);
    fs.updateScreen();
    pause(2);
    
    fs.closeScreen();
catch
    fs.closeScreen();
    rethrow(lasterror);
end
