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

Improve upon #858 #911

Merged
merged 8 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
build_type: [standard]
include:
- raytracing_label: raytracing
- exclude_deprecated_label: no-exclude-deprecated
- bundle_label: no-bundle
- egl_label: no-egl
- vtk_version: v9.0.0
Expand All @@ -68,11 +69,23 @@ jobs:
os: macos
vtk_version: commit
raytracing_label: no-raytracing
exclude_deprecated_label: no-exclude-deprecated
bundle_label: bundle
egl_label: no-egl
- build_type: headless
os: ubuntu
vtk_version: commit
raytracing_label: raytracing
exclude_deprecated_label: no-exclude-deprecated
bundle_label: no-bundle
egl_label: egl
- build_type: exclude_deprecated
os: ubuntu
vtk_version: commit
raytracing_label: raytracing
exclude_deprecated_label: exclude-deprecated
bundle_label: no-bundle
egl_label: no-egl

runs-on: ${{matrix.os}}-latest
container: ${{ matrix.os == 'ubuntu' && 'ghcr.io/f3d-app/f3d-ci' || null }}
Expand Down Expand Up @@ -163,6 +176,7 @@ jobs:
-DCMAKE_PREFIX_PATH:PATH=$(pwd)/../dependencies/install/
-DF3D_BINDINGS_JAVA=ON
-DF3D_BINDINGS_PYTHON=ON
-DF3D_EXCLUDE_DEPRECATED=${{ matrix.exclude_deprecated_label == 'exclude-deprecated' && 'ON' || 'OFF' }}
-DF3D_LINUX_GENERATE_MAN=ON
-DF3D_LINUX_INSTALL_DEFAULT_CONFIGURATION_FILE_IN_PREFIX=ON
-DF3D_MACOS_BUNDLE=${{ matrix.bundle_label == 'bundle' && 'ON' || 'OFF' }}
Expand Down Expand Up @@ -388,7 +402,6 @@ jobs:
-DF3D_PLUGIN_BUILD_DRACO=ON
-DF3D_PLUGIN_BUILD_OCCT=ON
-DF3D_STRICT_BUILD=ON
-DF3D_EXCLUDE_DEPRECATED=ON
-DF3D_TESTING_ENABLE_LONG_TIMEOUT_TESTS=ON

- name: Build
Expand Down
5 changes: 5 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ For F3D users:
- Fixed an issue with the binary release when opening draco files
- Fixed an issue with matcap textures

For libf3d users:
- Reworked image API to support many file formats to read (EXR, HDR) and write (PNG, JPG, TIF, BMP)
- Deprecated previous image API

For developers:
- Added a deprecation framework

For F3D packagers:
- Fixed compatibility with FreeBSD
Expand Down
2 changes: 1 addition & 1 deletion python/F3DPythonBindings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ PYBIND11_MODULE(f3d, module)
[=](const f3d::image& img)
{
PyErr_WarnEx(PyExc_DeprecationWarning, "getData is deprecated, use getContent instead.", 1);
getImageBytes(img);
return getImageBytes(img);
});
#pragma GCC diagnostic pop
#endif
Expand Down
5 changes: 5 additions & 0 deletions python/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ list(APPEND pyf3dTests_list
TestPythonUtils.py
)

if(NOT F3D_EXCLUDE_DEPRECATED)
list(APPEND pyf3dTests_list
TestPythonImageDataDeprecated.py)
endif()

if(NOT F3D_MACOS_BUNDLE)
list(APPEND pyf3dTests_list
TestPythonPlugins.py
Expand Down
4 changes: 2 additions & 2 deletions python/testing/TestPythonImageData.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

'''set data back'''

img.setData(data)
img.setContent(data)
assert img.getContent() == data

'''check channel type and save image'''
Expand All @@ -57,7 +57,7 @@
'''attempt to set partial data back'''

try:
img.setData(data[:-1])
img.setContent(data[:-1])
assert False, 'expected exception'
except ValueError:
assert True
55 changes: 55 additions & 0 deletions python/testing/TestPythonImageDataDeprecated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import sys
if sys.platform.startswith('win32'):
import os
os.add_dll_directory(sys.argv[1])

import f3d

engine = f3d.engine(f3d.window.NATIVE_OFFSCREEN)
window = engine.getWindow()
window.setSize(300, 200)


'''with background -> RGB image'''

img = window.renderToImage()
width = img.getWidth()
height = img.getHeight()
depth = img.getChannelCount()
data = img.getData()

assert width == window.getWidth()
assert height == window.getHeight()
assert depth == 3
assert isinstance(data, (bytes, bytearray))
assert len(data) == depth * width * height


'''without background -> RGBA image'''

img = window.renderToImage(True)
width = img.getWidth()
height = img.getHeight()
depth = img.getChannelCount()
data = img.getData()

assert width == window.getWidth()
assert height == window.getHeight()
assert depth == 4
assert isinstance(data, (bytes, bytearray))
assert len(data) == depth * width * height


'''set data back'''

img.setData(data)
assert img.getData() == data


'''attempt to set partial data back'''

try:
img.setData(data[:-1])
assert False, 'expected exception'
except ValueError:
assert True