@@ -53,6 +53,9 @@ IE_CORE_FORWARDDECLARE( Texture )
5353namespace GafferUI
5454{
5555
56+ // / Gadget suitable for displaying icons and the like. For
57+ // / high-performance display of images generated by ImageNode,
58+ // / see `GafferImageUI::ImageGadget`.
5659class GAFFERUI_API ImageGadget : public Gadget
5760{
5861
@@ -62,22 +65,29 @@ class GAFFERUI_API ImageGadget : public Gadget
6265 // / the GAFFERUI_IMAGE_PATHS environment variable.
6366 // / Throws if the file cannot be loaded.
6467 explicit ImageGadget ( const std::string &fileName );
65- // / A copy of the image is taken.
68+ // / \deprecated
6669 ImageGadget ( const IECoreImage::ConstImagePrimitivePtr image );
6770 ~ImageGadget () override ;
6871
6972 GAFFER_GRAPHCOMPONENT_DECLARE_TYPE ( GafferUI::ImageGadget, ImageGadgetTypeId, Gadget );
7073
7174 Imath::Box3f bound () const override ;
7275
73- // / Returns the texture loader used for converting images
74- // / on disk into textures for rendering. This is exposed
75- // / publicly so that other code can share the same texture
76- // / cache.
77- static IECoreGL::TextureLoader *textureLoader ();
78- // / Loads a texture using the `textureLoader()` and applies
79- // / the default ImageGadget texture parameters.
80- static IECoreGL::ConstTexturePtr loadTexture ( const std::string &fileName );
76+ struct GAFFERUI_API TextureParameters
77+ {
78+ GLint minFilter = GL_LINEAR_MIPMAP_LINEAR;
79+ GLint magFilter = GL_LINEAR;
80+ float lodBias = -1.0 ;
81+ GLint wrapS = GL_CLAMP_TO_BORDER;
82+ GLint wrapT = GL_CLAMP_TO_BORDER;
83+ static TextureParameters defaultParameters () { return {}; }
84+ };
85+
86+ // / Loads a texture suitable for rendering with `StandardStyle::renderImage()`,
87+ // / searching for it on the paths defined by the `GAFFERUI_IMAGE_PATHS` environment
88+ // / variable. Throws if the file cannot be loaded. Uses an internal cache, so the
89+ // / returned texture may be shared with other code, and is therefore const.
90+ static IECoreGL::ConstTexturePtr loadTexture ( const std::string &fileName, const TextureParameters ¶meters = TextureParameters::defaultParameters() );
8191
8292 protected :
8393
0 commit comments