diff --git a/inst/include/colourvalues/alpha/alpha.hpp b/inst/include/colourvalues/alpha/alpha.hpp index 0567150..6e8f14d 100644 --- a/inst/include/colourvalues/alpha/alpha.hpp +++ b/inst/include/colourvalues/alpha/alpha.hpp @@ -31,6 +31,8 @@ namespace alpha { bool normalise ) { + // Rcpp::Rcout << "a1: " << a << std::endl; + if( a.size() < 1 ) { Rcpp::stop("colourvalues - invalid alpha vector"); } @@ -42,15 +44,23 @@ namespace alpha { // Issue 47 Rcpp::NumericVector alpha = Rcpp::clone( a ); if ( alpha_type == ALPHA_PALETTE ) { + // Rcpp::Rcout << "returning alpha palette " << alpha << std::endl; return alpha; } if ( alpha_type == ALPHA_CONSTANT ) { if ( alpha[0] >= 0 && alpha[0] < 1 && !normalise ) { + // Rcpp::Rcout << "* 255" << std::endl; alpha = alpha * 255; + } else if ( alpha[0] > 1 && normalise ) { + // + //double initial_alpha = alpha[0]; + //initial_alpha = initial_alpha / 255.0; + alpha = alpha / 255.0; } Rcpp::NumericVector alpha_full( 5, alpha[0] ); // initialise with 5 vals (so i can create a spline object); + // Rcpp::Rcout << "returning alpha_full: " << alpha_full << std::endl; return alpha_full; } else if ( alpha_type == ALPHA_VECTOR ) { @@ -71,8 +81,10 @@ namespace alpha { for ( i = 0; i < n_alpha; i++ ) { alpha_fill[i] = alpha[i]; } + // Rcpp::Rcout << "returning alpha_fill: " << alpha_fill << std::endl; return alpha_fill; } + // Rcpp::Rcout << "returning alpha: " << alpha << std::endl; return alpha; } diff --git a/inst/include/colourvalues/colours/generate_colours.hpp b/inst/include/colourvalues/colours/generate_colours.hpp index f32cc39..c057903 100644 --- a/inst/include/colourvalues/colours/generate_colours.hpp +++ b/inst/include/colourvalues/colours/generate_colours.hpp @@ -208,7 +208,7 @@ namespace generate_colours { Rcpp::IntegerMatrix na_mat = colourvalues::convert::convert_hex_to_rgb( na_colour ); Rcpp::NumericMatrix na_mat_d = Rcpp::as< Rcpp::NumericMatrix >( na_mat ); - na_mat_d = na_mat_d / 255.0; + na_mat_d = na_mat_d / 1.0; R_xlen_t position_counter = 0; for( i = 0; i < n; ++i ) { @@ -311,7 +311,7 @@ namespace generate_colours { Rcpp::IntegerMatrix na_mat = colourvalues::convert::convert_hex_to_rgb( na_colour ); Rcpp::NumericMatrix na_mat_d = Rcpp::as< Rcpp::NumericMatrix >( na_mat ); - na_mat_d = na_mat_d / 255.0; + na_mat_d = na_mat_d / 1.0; R_xlen_t position_counter = 0;