16 texres->tin = (texres->tin - 0.5f) * tex->contrast + tex->bright - 0.5f; \
17 if (!(tex->flag & TEX_NO_CLAMP)) { \
18 if (texres->tin < 0.0f) { \
21 else if (texres->tin > 1.0f) { \
28 texres->trgba[0] = tex->rfac * \
29 ((texres->trgba[0] - 0.5f) * tex->contrast + tex->bright - 0.5f); \
30 texres->trgba[1] = tex->gfac * \
31 ((texres->trgba[1] - 0.5f) * tex->contrast + tex->bright - 0.5f); \
32 texres->trgba[2] = tex->bfac * \
33 ((texres->trgba[2] - 0.5f) * tex->contrast + tex->bright - 0.5f); \
34 if (!(tex->flag & TEX_NO_CLAMP)) { \
35 if (texres->trgba[0] < 0.0f) { \
36 texres->trgba[0] = 0.0f; \
38 if (texres->trgba[1] < 0.0f) { \
39 texres->trgba[1] = 0.0f; \
41 if (texres->trgba[2] < 0.0f) { \
42 texres->trgba[2] = 0.0f; \
45 if (tex->saturation != 1.0f) { \
47 rgb_to_hsv(texres->trgba[0], texres->trgba[1], texres->trgba[2], _hsv, _hsv + 1, _hsv + 2); \
48 _hsv[1] *= tex->saturation; \
50 _hsv[0], _hsv[1], _hsv[2], &texres->trgba[0], &texres->trgba[1], &texres->trgba[2]); \
51 if ((tex->saturation > 1.0f) && !(tex->flag & TEX_NO_CLAMP)) { \
52 if (texres->trgba[0] < 0.0f) { \
53 texres->trgba[0] = 0.0f; \
55 if (texres->trgba[1] < 0.0f) { \
56 texres->trgba[1] = 0.0f; \
58 if (texres->trgba[2] < 0.0f) { \
59 texres->trgba[2] = 0.0f; \
75 const float texvec[3],
76 struct TexResult *texres,
77 struct ImagePool *pool,
78 bool skip_load_image);
85 struct ImagePool *pool);
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float result[4], struct ImagePool *pool)
int imagewrap(struct Tex *tex, struct Image *ima, const float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool skip_load_image)