classdef StainedGlassImage < handle
% Defines a stained glass image, i.e., stained glass effect applied on an
% image.
% The stained glass effect comprises nr rows by nc columns of tiles.  Using
% a regular grid, each tile is rectangular and has a color obtained from 
% averaging the pixels in the tile.  In drawing the tile the interior grid
% points are perturbed so that the tiles appear as irregular quadrilaterals.
    
    properties
        imData   % array of uint8s (color values)
        nr       % number of rows of tiles
        nc       % number of columns of tiles
        tileSet  % 2-d simple array of Tile references
        grid     % 2-d simple array of Vertex references
        frac     % fraction for perturbing interior grid points
    end
    
    methods
        function SGI = StainedGlassImage(fname, nr, nc, noiseFrac)
        % Constructor: Create StainedGlassImage object from jpeg file named
        % by fname, using nr rows and nc columns of tiles
            SGI.imData= imread(fname);
            SGI.nr= nr;
            SGI.nc= nc;
            SGI.frac= noiseFrac;
            SGI.grid= Vertex.empty();
            SGI.tileSet= Tile.empty();
            SGI.applyEffect()
            SGI.showEffect()
        end
        
        function applyEffect(self)
        % Apply the stained glass effect to self
            %
            % Write your code here
            %
        end % applyEffect
        
        function showEffect(self)
        % Show the stained glass effect by drawing all the Tiles of self
            %
            % Write your code here
            %
        end % showEffect
        
    end % methods
       
end % classdef