Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_texture doc2test #4027

Merged
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
50 changes: 20 additions & 30 deletions src/doc/imagebufalgo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2925,41 +2925,31 @@ Import / export

Examples:

.. tabs::

.. code-tab:: c++

ImageBuf Input ("in.exr");
ImageSpec config;
config["maketx:highlightcomp"] = 1;
config["maketx:filtername"] = "lanczos3";
config["maketx:opaque_detect"] = 1;

bool ok = ImageBufAlgo::make_texture (ImageBufAlgo::MakeTxTexture,
Input, "texture.exr", config);
if (! ok)
std::cout << "make_texture error: " << OIIO::geterror() << "\n";

.. code-tab:: py
.. tabs::

Input = ImageBuf("in.exr")
config = ImageSpec()
config["maketx:highlightcomp"] = 1
config["maketx:filtername"] = "lanczos3"
config["maketx:opaque_detect"] = 1

ok = ImageBufAlgo.make_texture (OpenImageIO.MakeTxTexture,
Input, "texture.exr", config)
if not ok :
print("make_texture error:", OpenImageIO.geterror())
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-make-texture
:end-before: END-imagebufalgo-make-texture
:dedent: 4

.. code-tab:: bash oiiotool
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-make-texture
:end-before: END-imagebufalgo-make-texture
:dedent: 4

oiiotool in.exr -otex:hilightcomp=1:filtername=lanczos3:opaque_detect=1 texture.exr
.. tab:: oiiotool
.. sourcecode:: bash

oiiotool in.exr -otex:hilightcomp=1:filtername=lanczos3:opaque_detect=1 texture.exr

.. code-tab:: bash maketx
.. tab:: maketx
.. sourcecode:: bash

maketx in.exr --hicomp --filter lanczos3 --opaque-detect -o texture.exr
maketx in.exr --hicomp --filter lanczos3 --opaque-detect -o texture.exr

|

Expand Down
2 changes: 2 additions & 0 deletions testsuite/docs-examples-cpp/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ text2.exr : 640 x 480, 3 channel, float openexr
SHA-1: 53359E96A286F909A89ACC99A67A9ED3BADC4A7A
cshift.exr : 256 x 256, 4 channel, half openexr
SHA-1: 000F95FDC44D4DBDA8B4041C2506149C7AE28ACA
texture.exr : 256 x 256, 3 channel, half openexr (+mipmap)
SHA-1: 4074B050432CE7C664CEC4546A46E74F9A310CDC
Comparing "simple.tif" and "ref/simple.tif"
PASS
Comparing "scanlines.tif" and "ref/scanlines.tif"
Expand Down
1 change: 1 addition & 0 deletions testsuite/docs-examples-cpp/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"text1.exr",
"text2.exr",
"cshift.exr",
"texture.exr"
]
for file in hashes :
command += info_command(file, verbose=False)
Expand Down
18 changes: 18 additions & 0 deletions testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,23 @@ void example_circular_shift()
// Section: Import / export


void example_make_texture()
{
// BEGIN-imagebufalgo-make-texture
ImageBuf Input ("grid.exr");
ImageSpec config;
config["maketx:highlightcomp"] = 1;
config["maketx:filtername"] = "lanczos3";
config["maketx:opaque_detect"] = 1;

bool ok = ImageBufAlgo::make_texture (ImageBufAlgo::MakeTxTexture,
Input, "texture.exr", config);
if (! ok)
std::cout << "make_texture error: " << OIIO::geterror() << "\n";
// END-imagebufalgo-make-texture
}





Expand Down Expand Up @@ -308,6 +325,7 @@ int main(int /*argc*/, char** /*argv*/)
// Section: Color space conversion

// Section: Import / export
example_make_texture();

return 0;
}
2 changes: 2 additions & 0 deletions testsuite/docs-examples-python/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ text2.exr : 640 x 480, 3 channel, float openexr
SHA-1: 53359E96A286F909A89ACC99A67A9ED3BADC4A7A
cshift.exr : 256 x 256, 4 channel, half openexr
SHA-1: 000F95FDC44D4DBDA8B4041C2506149C7AE28ACA
texture.exr : 256 x 256, 3 channel, half openexr (+mipmap)
SHA-1: 4074B050432CE7C664CEC4546A46E74F9A310CDC
Comparing "simple.tif" and "ref/simple.tif"
PASS
Comparing "scanlines.tif" and "ref/scanlines.tif"
Expand Down
1 change: 1 addition & 0 deletions testsuite/docs-examples-python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"text1.exr",
"text2.exr",
"cshift.exr",
"texture.exr"
]
for file in hashes :
command += info_command(file, verbose=False)
Expand Down
16 changes: 16 additions & 0 deletions testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@ def example_circular_shift() :

# Section: Import / export

def example_make_texture():
# BEGIN-imagebufalgo-make-texture
Input = ImageBuf("grid.exr")
config = ImageSpec()
config["maketx:highlightcomp"] = 1
config["maketx:filtername"] = "lanczos3"
config["maketx:opaque_detect"] = 1

ok = ImageBufAlgo.make_texture (OpenImageIO.MakeTxTexture,
Input, "texture.exr", config)
if not ok :
print("make_texture error:", OpenImageIO.geterror())

# END-imagebufalgo-make-texture




Expand Down Expand Up @@ -297,3 +312,4 @@ def example_circular_shift() :
# Section: Color space conversion

# Section: Import / export
example_make_texture()