HighMap library (C++)
Loading...
Searching...
No Matches
colorize.hpp File Reference

Header file for functions related to applying colorization and hillshading. More...

Go to the source code of this file.

Classes

struct  hmap::ColorAdjust
struct  hmap::TerrainTextureParams

Namespaces

namespace  hmap

Enumerations

enum  hmap::MixMethod : int { hmap::MM_LINEAR , hmap::MM_SQRT_AVG , hmap::MM_MIXBOX }
 Methods for mixing/blending texture colors. More...
enum  hmap::NormalMapBlendingMethod : int {
  hmap::NMAP_LINEAR , hmap::NMAP_DERIVATIVE , hmap::NMAP_UDN , hmap::NMAP_UNITY ,
  hmap::NMAP_WHITEOUT
}

Functions

void hmap::apply_hillshade (Texture &img, const Array &array, float vmin=0.f, float vmax=1.f, float exponent=1.f)
 Apply hillshading to a Tensor image.
void hmap::apply_hillshade (std::vector< uint8_t > &img, const Array &array, float vmin=0.f, float vmax=1.f, float exponent=1.f, bool is_img_rgba=false)
 Apply hillshading to an 8-bit image.
void hmap::color_adjust (Array &r, Array &g, Array &b, ColorAdjust param, glm::ivec2 dither_seed)
 Apply color correction and tonemapping to RGB arrays.
Array hmap::color_match_mask (const Array &r, const Array &g, const Array &b, const glm::vec3 &color, float tolerance=0.f)
 Create a mask of pixels matching a target color within a tolerance.
Texture hmap::colorize (const Array &array, float vmin, float vmax, int cmap, bool hillshading, bool reverse=false, const Array *p_noise=nullptr)
 Apply colorization to an array.
Texture hmap::colorize (const Array &array, float vmin, float vmax, const std::vector< float > &positions, const std::vector< glm::vec3 > &colormap_colors, bool reverse=false, const Array *p_noise=nullptr)
 Colorize a scalar field into a Texture using a custom colormap.
Texture hmap::colorize_bivariate (const Array &a1, const Array &a2, const glm::vec2 range1, const glm::vec2 range2, const std::vector< float > &positions1, const std::vector< float > &positions2, const std::vector< glm::vec3 > &colormap_colors1, const std::vector< glm::vec3 > &colormap_colors2, MixMethod method=MM_SQRT_AVG, bool reverse1=false, bool reverse2=false, const Array *p_noise1=nullptr, const Array *p_noise2=nullptr)
 Colorize two scalar fields into a Texture using two custom colormaps and a color mixing method.
Texture hmap::colorize_grayscale (const Array &array)
 Convert an array to a grayscale image.
Texture hmap::colorize_histogram (const Array &array)
 Convert an array to a histogram-based grayscale image.
Texture hmap::colorize_slope_height_heatmap (const Array &array, int cmap)
 Colorizes a slope height heatmap based on the gradient norms of a given array.
Texture hmap::colorize_vec2 (const Array &array1, const Array &array2)
 Combine two arrays into a colored image.
Array hmap::luminance (const Texture &tex)
 Compute luminance from a Texture.
Texture hmap::mix (const Texture &tex1, const Texture &tex2, MixMethod method=MM_SQRT_AVG)
 Mix two textures into an output texture.
Texture hmap::mix (const Texture &tex1, const Texture &tex2, const Array &mask, MixMethod method=MM_SQRT_AVG, float gain=1.f)
 Mix two textures based on a transparency mask.
Texture hmap::mix (const std::vector< const Texture * > &texs, MixMethod method=MM_SQRT_AVG)
 Mix a list of textures sequentially.
Texture hmap::mix_normal_map (const Texture &nmap_base, const Texture &nmap_detail, float detail_scaling, NormalMapBlendingMethod blending_method)
 Blend two normal maps into a single output normal map.
glm::vec3 hmap::shade_color (const glm::vec3 &color, float t)
 Adjust color by shading parameter t clamped to [0, 1].
void hmap::shade_color (Texture &tex, const Array &factor)
 Apply shade_color to each pixel of a Texture using values from an Array.
void hmap::shade_topographic_residual (Texture &tex, const Array &z, int ir, float strength=1.0f)
 Apply shade_color to a Texture based on topographic residuals of an elevation array.
Texture hmap::terrain_texture (const Array &z, const Array *p_deposition=nullptr, const Array *p_snow_depth=nullptr, const TerrainTextureParams &params=TerrainTextureParams(), const BBox2D &bbox=BBox2D::unit(), const Array *p_noise=nullptr, ICommunicator &comm=SingleArrayComm::instance())
 Generate a procedural terrain texture from elevation and surface analysis.

Detailed Description

Header file for functions related to applying colorization and hillshading.

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)

This file contains the declarations of functions that are used to apply colorization and hillshading effects to images and arrays. The functions allow for creating grayscale, histogram-based, and colored images from elevation data and other input arrays.