mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-24 08:20:42 -04:00
UI: Add support for nonlinear SRGB blending
This commit is contained in:
@@ -5320,6 +5320,36 @@ QMenu *OBSBasic::AddScaleFilteringMenu(QMenu *menu, obs_sceneitem_t *item)
|
||||
return menu;
|
||||
}
|
||||
|
||||
void OBSBasic::SetBlendingMethod()
|
||||
{
|
||||
QAction *action = reinterpret_cast<QAction *>(sender());
|
||||
obs_blending_method method =
|
||||
(obs_blending_method)action->property("method").toInt();
|
||||
OBSSceneItem sceneItem = GetCurrentSceneItem();
|
||||
|
||||
obs_sceneitem_set_blending_method(sceneItem, method);
|
||||
}
|
||||
|
||||
QMenu *OBSBasic::AddBlendingMethodMenu(QMenu *menu, obs_sceneitem_t *item)
|
||||
{
|
||||
obs_blending_method blendingMethod =
|
||||
obs_sceneitem_get_blending_method(item);
|
||||
QAction *action;
|
||||
|
||||
#define ADD_MODE(name, method) \
|
||||
action = menu->addAction(QTStr("" name), this, \
|
||||
SLOT(SetBlendingMethod())); \
|
||||
action->setProperty("method", (int)method); \
|
||||
action->setCheckable(true); \
|
||||
action->setChecked(blendingMethod == method);
|
||||
|
||||
ADD_MODE("BlendingMethod.Default", OBS_BLEND_METHOD_DEFAULT);
|
||||
ADD_MODE("BlendingMethod.SrgbOff", OBS_BLEND_METHOD_SRGB_OFF);
|
||||
#undef ADD_MODE
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
void OBSBasic::SetBlendingMode()
|
||||
{
|
||||
QAction *action = reinterpret_cast<QAction *>(sender());
|
||||
@@ -5422,6 +5452,7 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview)
|
||||
delete previewProjectorSource;
|
||||
delete sourceProjector;
|
||||
delete scaleFilteringMenu;
|
||||
delete blendingMethodMenu;
|
||||
delete blendingModeMenu;
|
||||
delete colorMenu;
|
||||
delete colorWidgetAction;
|
||||
@@ -5554,6 +5585,9 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview)
|
||||
AddScaleFilteringMenu(scaleFilteringMenu, sceneItem));
|
||||
popup.addSeparator();
|
||||
|
||||
blendingMethodMenu = new QMenu(QTStr("BlendingMethod"));
|
||||
popup.addMenu(
|
||||
AddBlendingMethodMenu(blendingMethodMenu, sceneItem));
|
||||
blendingModeMenu = new QMenu(QTStr("BlendingMode"));
|
||||
popup.addMenu(AddBlendingModeMenu(blendingModeMenu, sceneItem));
|
||||
popup.addSeparator();
|
||||
@@ -9150,7 +9184,8 @@ void OBSBasic::on_actionCopySource_triggered()
|
||||
copyInfo.weak_source = OBSGetWeakRef(source);
|
||||
obs_sceneitem_get_info(item, ©Info.transform);
|
||||
obs_sceneitem_get_crop(item, ©Info.crop);
|
||||
copyInfo.blend = obs_sceneitem_get_blending_mode(item);
|
||||
copyInfo.blend_method = obs_sceneitem_get_blending_method(item);
|
||||
copyInfo.blend_mode = obs_sceneitem_get_blending_mode(item);
|
||||
copyInfo.visible = obs_sceneitem_visible(item);
|
||||
|
||||
clipboard.push_back(copyInfo);
|
||||
|
||||
Reference in New Issue
Block a user