diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index f7fb133..7c630ca 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -122,6 +122,7 @@ void gfx_blend_amap_bright(Texture *dst, int dx, int dy, Texture *src, int sx, i void gfx_blend_amap_alpha_src_bright(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int alpha, int rate); void gfx_blend_use_amap_color(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int r, int g, int b, int rate); void gfx_blend_screen(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); +void gfx_blend_multiply(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_fill(struct texture *dst, int x, int y, int w, int h, int r, int g, int b); void gfx_fill_alpha_color(struct texture *dst, int x, int y, int w, int h, int r, int g, int b, int a); void gfx_fill_amap(struct texture *dst, int x, int y, int w, int h, int a); diff --git a/src/draw.c b/src/draw.c index 17889a6..5973623 100644 --- a/src/draw.c +++ b/src/draw.c @@ -452,7 +452,16 @@ void gfx_blend_screen(Texture *dst, int dx, int dy, Texture *src, int sx, int sy run_copy_shader(©_shader.s, dst, src, &data); restore_blend_mode(); +} +void gfx_blend_multiply(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) +{ + glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ZERO, GL_ONE); + + struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h); + run_copy_shader(©_shader.s, dst, src, &data); + + restore_blend_mode(); } void gfx_fill(Texture *dst, int x, int y, int w, int h, int r, int g, int b) diff --git a/src/hll/DrawGraph.c b/src/hll/DrawGraph.c index d414854..4d1c53f 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -141,7 +141,11 @@ static void DrawGraph_BlendScreen(int dst, int dx, int dy, int src, int sx, int gfx_blend_screen(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); } -//void DrawGraph_BlendMultiply(int dst, int dx, int dy, int src, int sx, int sy, int w, int h); +static void DrawGraph_BlendMultiply(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) +{ + gfx_blend_multiply(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); +} + //void DrawGraph_BlendScreenAlpha(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha); static void DrawGraph_Fill(int dst, int x, int y, int w, int h, int r, int g, int b) @@ -391,7 +395,7 @@ HLL_LIBRARY(DrawGraph, HLL_EXPORT(BlendAMapAlphaSrcBright, DrawGraph_BlendAMapAlphaSrcBright), HLL_EXPORT(BlendUseAMapColor, DrawGraph_BlendUseAMapColor), HLL_EXPORT(BlendScreen, DrawGraph_BlendScreen), - //HLL_EXPORT(BlendMultiply, DrawGraph_BlendMultiply), + HLL_EXPORT(BlendMultiply, DrawGraph_BlendMultiply), //HLL_EXPORT(BlendScreenAlpha, DrawGraph_BlendScreenAlpha), HLL_EXPORT(Fill, DrawGraph_Fill), HLL_EXPORT(FillAlphaColor, DrawGraph_FillAlphaColor),