Skip to content

Add image(buffer, size) API#2961

Open
RealEdwardS wants to merge 53 commits into
f3d-app:masterfrom
RealEdwardS:add-image-function-api
Open

Add image(buffer, size) API#2961
RealEdwardS wants to merge 53 commits into
f3d-app:masterfrom
RealEdwardS:add-image-function-api

Conversation

@RealEdwardS

@RealEdwardS RealEdwardS commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

Add image(buffer, size) API

Requires vtk version that contains CanReadFile(stream) API (> 9.6)
https://gitlab.kitware.com/vtk/vtk/-/commit/675e97fa64a9563f6ec6f1fbf06aba84b2920ea8

Having a bit of trouble finding the right type conversions for Javascript bindings, but a review of what I have so far & feedback would be much appreciated!

Issue ticket number and link if any

Checklist for finalizing the PR

  • I have performed a self-review of my code
  • I have added tests for new features and bugfixes
  • I have added documentation for new features
  • If it is a modifying the libf3d API, I have updated bindings
  • If it is a modifying the .github/workflows/versions.json, I have updated docker_timestamp

AI Disclosure

  • I did not use AI to generate any of the content of that pull request
  • I used AI to generate code in that pull request, if yes please disclose which part of the code was generated and with which model.
  • ...

Continuous integration

Please write a comment to run CI, eg: \ci fast.
See here for more info.

@github-actions

Copy link
Copy Markdown

You are modifying libf3d public API! ⚠️Please update bindings accordingly⚠️!
You can find them in their respective directories: c, python, java, webassembly.

Comment thread python/F3DPythonBindings.cxx Outdated
@mwestphal mwestphal requested review from Meakk and mwestphal March 22, 2026 06:49
Comment thread library/src/config.cxx Outdated
Comment thread library/src/image.cxx Outdated
Comment thread library/src/image.cxx Outdated
Comment thread library/public/image.h Outdated

@mwestphal mwestphal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need some changes, lets focus on the C++ api first.

Comment thread python/F3DPythonBindings.cxx
@mwestphal

Copy link
Copy Markdown
Member

Please request a review when needed :)

@Meakk Meakk removed their request for review March 27, 2026 21:27
@RealEdwardS RealEdwardS force-pushed the add-image-function-api branch 2 times, most recently from 991a1e1 to 6bda499 Compare April 6, 2026 08:13
@RealEdwardS RealEdwardS marked this pull request as ready for review April 6, 2026 08:14
@mwestphal

mwestphal commented Apr 6, 2026

Copy link
Copy Markdown
Member

@RealEdwardS RealEdwardS marked this pull request as ready for review 11 minutes ago

Please actually request a review from a maintainer, top right of the PR :)

@RealEdwardS RealEdwardS requested review from Meakk and mwestphal April 6, 2026 08:28
Comment thread library/public/image.h Outdated
Comment thread library/src/image.cxx Outdated
Comment thread library/src/image.cxx
Comment thread library/src/image.cxx Outdated
Comment thread library/src/image.cxx Outdated
Comment thread library/testing/TestSDKImage.cxx Outdated
Comment thread library/testing/TestSDKImage.cxx Outdated
Comment thread library/testing/TestSDKImage.cxx Outdated

@mwestphal mwestphal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some changes

@RealEdwardS RealEdwardS force-pushed the add-image-function-api branch from 6bda499 to ac5f76f Compare April 7, 2026 00:57
Meakk
Meakk previously approved these changes Apr 8, 2026

@Meakk Meakk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RealEdwardS RealEdwardS requested a review from mwestphal April 11, 2026 14:03
@RealEdwardS

Copy link
Copy Markdown
Contributor Author

@mwestphal can you check my latest CI? There are 2 macos_arm (commit, bundle, no-static) jobs and in one of them, the TestUSDRigArmatureWithOpacity testcase (which doesn't seem to be relevant to my commits) fails while the other passes. What's the difference between these two jobs?

@mwestphal

Copy link
Copy Markdown
Member

@mwestphal can you check my latest CI? There are 2 macos_arm (commit, bundle, no-static) jobs and in one of them, the TestUSDRigArmatureWithOpacity testcase (which doesn't seem to be relevant to my commits) fails while the other passes. What's the difference between these two jobs?

its a flaky test, you can ignore it

@RealEdwardS RealEdwardS requested review from Meakk and mwestphal June 16, 2026 04:47
Comment thread library/src/image.cxx
Comment thread library/testing/TestImageStream.cxx Outdated
Comment thread library/testing/TestSDKImageStream.cxx
Comment thread library/public/image.h
Comment thread c/testing/test_image_stream.c Outdated
Comment thread c/testing/test_image_stream.c Outdated
Comment thread c/testing/test_image_stream.c

@mwestphal mwestphal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing webassembly bindings

@mwestphal mwestphal requested a review from snoyer June 16, 2026 06:16
@mwestphal

Copy link
Copy Markdown
Member

Please check the PR description checkboxes.

@mwestphal

Copy link
Copy Markdown
Member

Missing webassembly bindings

Having a bit of trouble finding the right type conversions for Javascript bindings,

Maybe @Meakk can help ? :)

@RealEdwardS

Copy link
Copy Markdown
Contributor Author

Missing webassembly bindings

There were some issues with Webassembly/Emscripten, discussed in this thread, i'm currently skipping it for now

@Meakk

Meakk commented Jun 16, 2026

Copy link
Copy Markdown
Member

Maybe something like that?

.class_function("createFromBuffer", +[](emscripten::val jsbuf) -> f3d::image
      {
        std::vector<unsigned char> data = emscripten::vecFromJSArray<unsigned char>(jsbuf);
        return f3d::image(reinterpret_cast<std::byte*>(data.data()), data.size());
      }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add image(buffer, size) API

4 participants