Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dearpygui/_dearpygui.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions dearpygui/_dearpygui_RTD.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions dearpygui/dearpygui.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/dearpygui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ GetModuleConstants()
ModuleConstants.push_back({ "mvFormat_Float_rgba", 0L });
ModuleConstants.push_back({ "mvFormat_Float_rgb", 1L });

ModuleConstants.push_back({ "mvTextureFilter_Linear", mvTextureFilter_Linear });
ModuleConstants.push_back({ "mvTextureFilter_Nearest", mvTextureFilter_Nearest });

ModuleConstants.push_back({ "mvThemeCat_Core", 0L });
ModuleConstants.push_back({ "mvThemeCat_Plots", 1L});
ModuleConstants.push_back({ "mvThemeCat_Nodes", 2L});
Expand Down
9 changes: 6 additions & 3 deletions src/mvAppItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4636,7 +4636,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
setup.createContextManager = true;
break;
}
case mvAppItemType::mvStaticTexture:
case mvAppItemType::mvStaticTexture:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID)
Expand All @@ -4646,12 +4646,13 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::Integer, "height" });
args.push_back({ mvPyDataType::FloatList, "default_value" });
args.push_back({ mvPyDataType::UUID, "parent", mvArgType::KEYWORD_ARG, "internal_dpg.mvReservedUUID_2", "Parent to add this item to. (runtime adding)" });
args.push_back({ mvPyDataType::Integer, "filter", mvArgType::KEYWORD_ARG, "0", "Texture sampling mode (mvTextureFilter_Linear or mvTextureFilter_Nearest)." });

setup.about = "Adds a static texture.";
setup.category = { "Textures", "Widgets" };
break;
}
case mvAppItemType::mvDynamicTexture:
case mvAppItemType::mvDynamicTexture:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID)
Expand All @@ -4661,6 +4662,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::Integer, "height" });
args.push_back({ mvPyDataType::FloatList, "default_value" });
args.push_back({ mvPyDataType::UUID, "parent", mvArgType::KEYWORD_ARG, "internal_dpg.mvReservedUUID_2", "Parent to add this item to. (runtime adding)" });
args.push_back({ mvPyDataType::Integer, "filter", mvArgType::KEYWORD_ARG, "0", "Texture sampling mode (mvTextureFilter_Linear or mvTextureFilter_Nearest)." });

setup.about = "Adds a dynamic texture.";
setup.category = { "Textures", "Widgets" };
Expand Down Expand Up @@ -5414,7 +5416,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
setup.category = { "Widgets", "Values" };
break;
}
case mvAppItemType::mvRawTexture:
case mvAppItemType::mvRawTexture:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID)
Expand All @@ -5425,6 +5427,7 @@ DearPyGui::GetEntityParser(mvAppItemType type)
args.push_back({ mvPyDataType::FloatList, "default_value" });
args.push_back({ mvPyDataType::Integer, "format", mvArgType::KEYWORD_ARG, "internal_dpg.mvFormat_Float_rgba", "Data format." });
args.push_back({ mvPyDataType::UUID, "parent", mvArgType::KEYWORD_ARG, "internal_dpg.mvReservedUUID_2", "Parent to add this item to. (runtime adding)" });
args.push_back({ mvPyDataType::Integer, "filter", mvArgType::KEYWORD_ARG, "0", "Texture sampling mode (mvTextureFilter_Linear or mvTextureFilter_Nearest)." });

setup.about = "Adds a raw texture.";
setup.category = { "Textures", "Widgets" };
Expand Down
10 changes: 7 additions & 3 deletions src/mvAppleSpecifics.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ struct mvViewportData

struct mvGraphics_Metal
{
MTLRenderPassDescriptor* renderPassDescriptor;
id <MTLCommandQueue> commandQueue;
id <MTLDevice> device;
MTLRenderPassDescriptor* renderPassDescriptor;
id <MTLCommandQueue> commandQueue;
id <MTLDevice> device;

id <MTLRenderPipelineState> nearestPipelineState;
id <MTLSamplerState> nearestSampler;
id <MTLRenderCommandEncoder> __unsafe_unretained currentEncoder;
};
9 changes: 9 additions & 0 deletions src/mvBasicWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "mvContainers.h"
#include "mvItemHandlers.h"
#include "mvTextureItems.h"
#include "mvUtilities.h"

#include <misc/cpp/imgui_stdlib.h>
#include <imgui_internal.h>
Expand Down Expand Up @@ -5604,13 +5605,17 @@ DearPyGui::draw_image(ImDrawList* drawlist, mvAppItem& item, mvImageConfig& conf
ImGuiContext& g = *GImGui;
ImGui::PushStyleVar(ImGuiStyleVar_ImageBorderSize, (config.borderColor.a > 0.0f) ? ImMax(1.0f, g.Style.ImageBorderSize) : 0.0f);
ImGui::PushStyleColor(ImGuiCol_Border, config.borderColor.toVec4());
const bool wantNearest = (static_cast<mvTextureItem*>(config.texture.get())->_filter == mvTextureFilter_Nearest);
ImDrawList* windowDrawList = wantNearest ? ImGui::GetWindowDrawList() : nullptr;
if (wantNearest) EnterNearestFilterScope(windowDrawList);
ImGui::ImageWithBg(
texture,
ImVec2((float)item.config.width, (float)item.config.height),
ImVec2(config.uv_min.x, config.uv_min.y),
ImVec2(config.uv_max.x, config.uv_max.y),
ImVec4(0, 0, 0, 0),
config.tintColor.toVec4());
if (wantNearest) LeaveNearestFilterScope(windowDrawList);
ImGui::PopStyleColor();
ImGui::PopStyleVar();
}
Expand Down Expand Up @@ -5717,12 +5722,16 @@ DearPyGui::draw_image_button(ImDrawList* drawlist, mvAppItem& item, mvImageButto
if (config.framePadding >= 0)
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2((float)config.framePadding, (float)config.framePadding));

const bool wantNearest = (static_cast<mvTextureItem*>(config.texture.get())->_filter == mvTextureFilter_Nearest);
ImDrawList* windowDrawList = wantNearest ? ImGui::GetWindowDrawList() : nullptr;
if (wantNearest) EnterNearestFilterScope(windowDrawList);
if (ImGui::ImageButton(item.info.internalLabel.c_str(), texture, ImVec2((float)item.config.width, (float)item.config.height),
ImVec2(config.uv_min.x, config.uv_min.y), ImVec2(config.uv_max.x, config.uv_max.y),
config.backgroundColor, config.tintColor))
{
item.submitCallback();
}
if (wantNearest) LeaveNearestFilterScope(windowDrawList);

if (config.framePadding >= 0)
ImGui::PopStyleVar();
Expand Down
Loading