Jump to content

Raster manipulation class

Recommended Posts

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...