kramer3d Posted May 16, 2016 Share Posted May 16, 2016 Hi all, Here's a noob question: is there any convienience class for per pixel raster image manipulation in HDK? By that I mean something simple and stupid with a method like putPixel(int x, int y, const UT_RGBA& pixel). All of the classes like IMG_Raster, PXL_Raster and so on seem to serve a different purpose and do not have such functionality. Of course I can calculate an offset into the buffer myself, but maybe someone could point me at the class that does it or suggest a better way of doing it?. I need this for temporary visualization purposes only, and performance is not an issue. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
symek Posted May 19, 2016 Share Posted May 19, 2016 Not very elegant but PXL_Raster has get/setPixelValue(x, y, float*) and writeToRow(int, void*). Also IMG_File has readIntoBuffer(int, buffer) among others, buffer can be allocated with IMG_File::allocScanlineBuffer for extra luxury I don't think there is easier way though.. Quote Link to comment Share on other sites More sharing options...
malexander Posted May 19, 2016 Share Posted May 19, 2016 PXL/TIL_Raster is the class you want to use. setPixelValue() takes 1-4 floats, depending on the packing of the raster (1-4 components). It'll then convert the 0..1 FP value to whatever data format you've specified for the raster. You can also use clear() to initialize the raster to a constant value. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.