public boolean maskContainsRelativePoint(Point relativep, int maskindex)
	{		
		// In case mask is not used (mask == null), always returns true
		if (getMask() == null)
			return true;
		
		// Checks if the maskindex was a valid number
		if (maskindex >= getMask().getImageNumber())
			maskindex = getMask().getImageNumber() - 1;
		
		// Checks whether the point is within the mask and returns false if 
		// it isn't
		if (!HelpMath.pointIsInRange(relativep, 0, getMask().getWidth(), 0, 
				getMask().getHeight()))
			return false;

		if (maskindex >= 0)
		{
			int c = this.mask.getSubImage(maskindex).getRGB(relativep.x, relativep.y);
			return c == maskcolor;
		}
		// If maskindex was negative has to check each subimage
		else
		{
			for (int i = 0; i < getMask().getImageNumber(); i++)
			{
				int c = getMask().getSubImage(i).getRGB(relativep.x, relativep.y);
				if (c == maskcolor)
					return true;
			}
			return false;
		}
	}