Add support for free-form triangle shading objects.#157
Add support for free-form triangle shading objects.#157bramton merged 1 commit intolibharu:develfrom alliepiper:shadings
Conversation
|
Cc: @opoplawski for Fedora VTK/ParaView packages, libharu will need this patch if VTK is to use the system version. I'll try and find the other distro maintainer github accounts… |
|
Cc: @lu-zero @domibel @samueljohn @badshah400 (Sorry if my maintainer list is out-of-date.) |
|
I'm not really the person keeping vtk up in Gentoo, the sci@gentoo.org alias collectively maintains it. |
|
@mathstuf Thanks for the ping. I will get this patch into openSUSE's packages. |
mathstuf
left a comment
There was a problem hiding this comment.
High-level overview only; I don't know enough about the spec to review the rest.
src/hpdf_pages.c
Outdated
| /* search shading-object from shading-resource */ | ||
| key = HPDF_Dict_GetKeyByObj (attr->shadings, shading); | ||
| if (!key) { | ||
| /* if the shading is not resisterd in shadings resource, register |
There was a problem hiding this comment.
"resisters" -> "registered"
There was a problem hiding this comment.
Ah, yeah. I copy/pasted that bit from somewhere else. I'll clean up the other instances too.
| return HPDF_TRUE; | ||
| } | ||
|
|
||
| static void UINT32Swap (HPDF_UINT32 *value) |
There was a problem hiding this comment.
I thought there was a C standard header which provided these functions.
| HPDF_DOUBLE norm = (x - xMin) / (xMax - xMin); | ||
| HPDF_DOUBLE max = (HPDF_DOUBLE)(0xFFFFFFFF); | ||
| HPDF_UINT32 enc = (HPDF_UINT32)(norm * max); | ||
| UINT32Swap(&enc); |
There was a problem hiding this comment.
Or maybe this should be "make into big endian order" like the pton family. Does this swap need to happen on big endian architectures?
There was a problem hiding this comment.
This would be htonl (host-to-network-long), conforming to POSIX.1-2001
|
The byteswap thing follows the same pattern used other places in the libharu code, so I just went for consistency. If a libharu dev has an issue with this bit I can rework it, but until there's a problem I think this is good enough for us. I don't think we're targeting any BE archs anyway, so it's not worth the trouble (especially since this project appears to be abandoned -- I get the feeling that this patch will live as an MR forever ;) ) |
|
OK, I'd suggest opening an issue. I know that at least Debian targets BE architectures, but I don't know how much libharu or VTK is used on those. |
src/hpdf_shading.c
Outdated
|
|
||
| HPDF_Real r; | ||
|
|
||
| for (int i = 0; i < 4; ++i) |
There was a problem hiding this comment.
for (int ..) not allowed in C code.
There was a problem hiding this comment.
Well, it's allowed in "newer" C code (C99), but I guess libharu uses an older standard of C?
There was a problem hiding this comment.
Most versions of MSVC barely support C99 (if they support it at all), so we're more or less stuck with pre-C99 standards until we stop caring about MSVC < 2015 ;-)
There was a problem hiding this comment.
They support this much (because it's part of the C++ standard). The complainer in ParaView was actually an older GCC which doesn't default to C99 without a flag :) .
|
does this patch has API reference or examples? work for days, still didn't figure out how to use it |
|
The only example of its use that I'm aware of is here. The shadings follows a similar pattern to the other HPDF objects. |
|
thank you for the example. |
add shading type 3, function 2,RGB. modify shading type 4, from libharu#157 pull request.
|
Is this complete, or still in progress? |
|
Yes. It's working well enough for our purposes in VTK, and I don't intend to make any more changes to this patch. |
VTK requires a patched libharu that is not maintained upstream See libharu/libharu#157
VTK requires a patched libharu that is not maintained upstream See libharu/libharu#157
The pull request has languished for more than two year. Some ports (e.g. VTK) rely on the new functionality. See libharu/libharu#157
|
There is an issue with this PR when used in VTK, there is a missing symbol export: This was initially reported against the ArchLinux vtk package, when trying to import the |
|
@ArchangeGabriel I'm no longer actively working on VTK, but they may be interested in fixing this. Can you make sure this gets reported at https://gitlab.kitware.com/vtk/vtk? |
|
A colleague investigated the issue, and this is because we were building with autotools instead of CMake (so VTK is not affected). We switched to CMake to solve the issue. I think this should be sufficient for anyone stumbling upon this. |
|
Ah, that makes sense. @allisonvacanti if you give me access to your fork, I can update the PR directly if there are any changes that need to be made. |
|
@mathstuf I unfortunately deleted that fork a while ago. If you'd like to make a new PR under a KW managed account I can close this and update the description to link to the maintained version. |
|
Ah. I'll make a new PR if there's ever any movement on this. If adding autotools support is going to have just as many crickets…not sure it's the best use of my time. |
|
@mathstuf I honestly don’t think it’s worth it, only people ever affected are the ones building ParaView/VTK themselves with external dependencies instead of vendored one, that took the time to patch their libharu to make it suitable for this, and used autotools instead of CMake. If they went as far, they do know about this ticket and should be able to find the information here. I guess it’s just a coincidence that it went under radar all this time in Arch, but now it’s fixed for us, so I guess this PR can go back to the deadly silence I’ve awoken it from. ;) |
We needed the ability to draw polygons with smoothly interpolated vertex colors in VTK, and this patch is sufficient for our needs. Sharing as a MR if anyone else is interested.
Refs #102