int main() try { png::image< png::index_pixel_1 > image1; generate_image(image1); image1.write("out/palette1.png.out"); png::image< png::index_pixel_2 > image2; generate_image(image2); image2.write("out/palette2.png.out"); png::image< png::index_pixel_4 > image4; generate_image(image4); image4.write("out/palette4.png.out"); png::image< png::index_pixel > image8; generate_image(image8); image8.write("out/palette8.png.out"); png::image< png::index_pixel > image8_tRNS; generate_image(image8_tRNS); png::tRNS trns(256); for (size_t i = 0; i < trns.size(); ++i) { trns[i] = i; } image8_tRNS.set_tRNS(trns); image8_tRNS.write("out/palette8_tRNS.png.out"); } catch (std::exception const& error) { std::cerr << "generate_palette: " << error.what() << std::endl; return EXIT_FAILURE; }
bool ChessBoard::turn(int row, int column) { if( !m_selected_piece ) return false; // get possible turns QScopedPointer< const QList<QSize> > trns(m_selected_piece->getPossibleTurns( column, row )); // current coords QSize cur_coords = m_selected_piece->getCoords(); QList<QSize>::const_iterator it; for(it = trns->begin(); it != trns->end(); it++) { QSize coords_sum = b_black_bottom ^ m_selected_piece->m_bWhite ? cur_coords - (*it) : cur_coords + (*it); if( coords_sum == turn_coords ) { emit figureMoved(cur_coords, turn_coords); PiecePtr &turned = pieceAt(column, row); m_selected_piece->setCoords(turn_coords); turned.swap(m_selected_piece); return true; } } return false; }