Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 775ac83

Browse filesBrowse files
committed
[[ Blend Modes ]] Support some blend modes in openGL compositor
1 parent 35b5848 commit 775ac83
Copy full SHA for 775ac83

File tree

Expand file treeCollapse file tree

2 files changed

+62
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+62
-2
lines changed

‎engine/src/tilecachecg.cpp

Copy file name to clipboardExpand all lines: engine/src/tilecachecg.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ bool MCTileCacheCoreGraphicsCompositor_BeginLayer(void *p_context, const MCRecta
199199
t_blend_mode = kCGBlendModeClear;
200200
break;
201201
case GXblendSrc:
202-
case GXblendSrcOver:
203-
case GXcopy:
204202
t_blend_mode = kCGBlendModeCopy;
205203
break;
206204
case GXblendDst:
@@ -232,6 +230,8 @@ bool MCTileCacheCoreGraphicsCompositor_BeginLayer(void *p_context, const MCRecta
232230
case GXblendPlus:
233231
t_blend_mode = kCGBlendModePlusLighter;
234232
break;
233+
case GXblendSrcOver:
234+
case GXcopy:
235235
default:
236236
t_blend_mode = kCGBlendModeNormal;
237237
break;

‎engine/src/tilecachegl.cpp

Copy file name to clipboardExpand all lines: engine/src/tilecachegl.cpp
+60Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,66 @@ bool MCTileCacheOpenGLCompositor_BeginLayer(void *p_context, const MCRectangle&
555555
self -> is_blending = true;
556556
glEnable(GL_BLEND);
557557
}
558+
559+
switch(p_ink)
560+
{
561+
case GXblendClear:
562+
case GXclear:
563+
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
564+
break;
565+
case GXblendSrc:
566+
glBlendFunc(GL_ONE, GL_ZERO);
567+
break;
568+
case GXblendDst:
569+
glBlendFunc(GL_ZERO, GL_ONE);
570+
break;
571+
case GXblendDstOver:
572+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
573+
break;
574+
case GXblendSrcIn:
575+
glBlendFunc(GL_DST_ALPHA, GL_ZERO);
576+
break;
577+
case GXblendDstIn:
578+
glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
579+
break;
580+
case GXblendSrcOut:
581+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
582+
break;
583+
case GXblendDstOut:
584+
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
585+
break;
586+
case GXblendSrcAtop:
587+
glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
588+
break;
589+
case GXblendDstAtop:
590+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
591+
break;
592+
case GXblendXor:
593+
case GXxor:
594+
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
595+
break;
596+
case GXblendPlus:
597+
glBlendFunc(GL_ONE, GL_ONE);
598+
break;
599+
case GXblendScreen:
600+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
601+
break;
602+
case GXblendMultiply:
603+
case GXblendOverlay:
604+
case GXblendDarken:
605+
case GXblendLighten:
606+
case GXblendDodge:
607+
case GXblendBurn:
608+
case GXblendSoftLight:
609+
case GXblendHardLight:
610+
case GXblendDifference:
611+
case GXblendExclusion:
612+
case GXblendSrcOver:
613+
case GXcopy:
614+
default:
615+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
616+
break;
617+
}
558618

559619
self -> current_opacity = p_opacity;
560620

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.