All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.chessboard.jfl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2009 Michael Bedward
 *
 * This file is part of jai-tools.

 * jai-tools is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.

 * jai-tools 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 Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with jai-tools.  If not, see .
 *
 */

/*
 * This script creates an 8 x 8 chessboard pattern
 *
 * Author: Michael Bedward
 */

len = width() > height() ? width() : height()
square = floor(len / 8)
edge_pos = square * 8;

odd_row = floor(y() / square) % 2 == 1
odd_col = floor(x() / square) % 2 == 1
inside = x() < edge_pos && y() < edge_pos

result = inside ? (odd_row ^| odd_col) : null




© 2015 - 2025 Weber Informatics LLC | Privacy Policy