Jump to content

Threading and batching questions


paladinz

Recommended Posts

I am very new to Paint.NET effects development and I have not been able to find answers to these 2 questions. If they have already been answered elsewhere, my apologies (please let me know where, though!):

I am using CodeLab, if it matters.

1. I am trying to create an effect that does a custom palletization routine on the image. I basically need to: (a) go through the entire image and collect color frequencies, then (B) create a color index, followed by © map each pixel in the image to one of those indexed colors. The Render function is called multiple times for different Rectangles. Right now, I'm basically throwing a small hack so that it ignores the call each time after the first one; I do all of these operations in the first call. This effectively takes away any multithreading in the code. The problem is that (a) and (B) MUST be done before ©. (a) and © can both be multithreaded, but I have to ensure that there are 3 discrete passes. How do I accomplish this? Is there a PreRender() or PostRender() function?

2. Is there a way to batch an effect on multiple images? (I have a whole folder of images I would like palletized.)

Thanks!

Link to comment
Share on other sites

Instead of using CodeLab, you should probably be using Sepcot's excellent template for writing effects:

viewtopic.php?f=5&t=2618

Since you understand the problem you are having, you should see how the render function in the template solves it for you.

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.

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