mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-27 15:48:44 -05:00
UI: Add support for nonlinear SRGB blending
This commit is contained in:
@@ -26,7 +26,8 @@ struct AddSourceData {
|
||||
bool visible;
|
||||
obs_transform_info *transform = nullptr;
|
||||
obs_sceneitem_crop *crop = nullptr;
|
||||
obs_blending_type *blend = nullptr;
|
||||
obs_blending_method *blend_method = nullptr;
|
||||
obs_blending_type *blend_mode = nullptr;
|
||||
};
|
||||
|
||||
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t *source)
|
||||
@@ -124,8 +125,11 @@ static void AddSource(void *_data, obs_scene_t *scene)
|
||||
obs_sceneitem_set_info(sceneitem, data->transform);
|
||||
if (data->crop != nullptr)
|
||||
obs_sceneitem_set_crop(sceneitem, data->crop);
|
||||
if (data->blend != nullptr)
|
||||
obs_sceneitem_set_blending_mode(sceneitem, *data->blend);
|
||||
if (data->blend_method != nullptr)
|
||||
obs_sceneitem_set_blending_method(sceneitem,
|
||||
*data->blend_method);
|
||||
if (data->blend_mode != nullptr)
|
||||
obs_sceneitem_set_blending_mode(sceneitem, *data->blend_mode);
|
||||
|
||||
obs_sceneitem_set_visible(sceneitem, data->visible);
|
||||
}
|
||||
@@ -151,7 +155,8 @@ char *get_new_source_name(const char *name, const char *format)
|
||||
|
||||
static void AddExisting(OBSSource source, bool visible, bool duplicate,
|
||||
obs_transform_info *transform, obs_sceneitem_crop *crop,
|
||||
obs_blending_type *blend)
|
||||
obs_blending_method *blend_method,
|
||||
obs_blending_type *blend_mode)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
@@ -175,7 +180,8 @@ static void AddExisting(OBSSource source, bool visible, bool duplicate,
|
||||
data.visible = visible;
|
||||
data.transform = transform;
|
||||
data.crop = crop;
|
||||
data.blend = blend;
|
||||
data.blend_method = blend_method;
|
||||
data.blend_mode = blend_mode;
|
||||
|
||||
obs_enter_graphics();
|
||||
obs_scene_atomic_update(scene, AddSource, &data);
|
||||
@@ -184,12 +190,13 @@ static void AddExisting(OBSSource source, bool visible, bool duplicate,
|
||||
|
||||
static void AddExisting(const char *name, bool visible, bool duplicate,
|
||||
obs_transform_info *transform, obs_sceneitem_crop *crop,
|
||||
obs_blending_type *blend)
|
||||
obs_blending_method *blend_method,
|
||||
obs_blending_type *blend_mode)
|
||||
{
|
||||
OBSSourceAutoRelease source = obs_get_source_by_name(name);
|
||||
if (source) {
|
||||
AddExisting(source.Get(), visible, duplicate, transform, crop,
|
||||
blend);
|
||||
blend_method, blend_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +256,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
|
||||
QString source_name = item->text();
|
||||
AddExisting(QT_TO_UTF8(source_name), visible, false, nullptr,
|
||||
nullptr, nullptr);
|
||||
nullptr, nullptr, nullptr);
|
||||
|
||||
OBSBasic *main =
|
||||
reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
@@ -287,7 +294,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
main->SetCurrentScene(scene_source, true);
|
||||
obs_source_release(scene_source);
|
||||
AddExisting(QT_TO_UTF8(source_name), visible, false,
|
||||
nullptr, nullptr, nullptr);
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
};
|
||||
|
||||
undo_s.add_action(QTStr("Undo.Add").arg(source_name), undo,
|
||||
@@ -438,5 +445,5 @@ void OBSBasicSourceSelect::SourcePaste(SourceCopyInfo &info, bool dup)
|
||||
return;
|
||||
|
||||
AddExisting(source, info.visible, dup, &info.transform, &info.crop,
|
||||
&info.blend);
|
||||
&info.blend_method, &info.blend_mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user