Older Newer
Tue, 02 Apr 2013 06:48:16 . . . . SyneRyder


Changes by last author:

Added:
= FAQ =

== Getting Started ==

=== Where can I find example source code? ===

If you look inside your FilterMeister installation directory, you will find lots of examples in the Democodes folder. Depending on where you have installed FilterMeister, the folder might be something like: C:\Program Files\FilterMeister\sourcecode\democodes. There are also coding examples on many pages of this Wiki.

== Dialog Questions ==

=== How do I hide the FilterMeister logo and default controls? ===

You can use the NONE keyword with each control in the following manner:

<code>

ctl[CTL_LOGO]: NONE

</code>

The example above removes the gnome image from the bottom right corner of the plug-in interface. You can use similar code to hide the other built-in controls, such as the CTL_OK and CTL_CANCEL buttons. As of FilterMeister 1.0 Beta 9d, the only control that you can't hide is the CTL_PREVIEW. In some older versions of FilterMeister, there are some other controls you can't hide, and you may need to use a program like [Resource Hacker] to edit the plug-in interface directly.

=== How do I resize the preview control? ===

As of FilterMeister 1.0 Beta 9d, you can do this using FilterMeister code, or using a control definition. To create a preview that is 100 DBUs wide, 200 DBUs high, and positioned 10 DBUs from the top left corner, you would use the following control definition:

<code>

ctl[CTL_PREVIEW]: MODIFY, Pos=(10,10), Size=(100,200)

</code>

or the following in your code:

<code>

setCtlPos(CTL_PREVIEW, 10, 10, 100, 200);

</code>

If you are stlll using an older version of FilterMeister, you will need to use [Resource Hacker] instead to resize the window. This is how you would do it:

*Run Resource Hacker.

*Go to File -> Open and find your compiled .8bf file. You may need to select All Files (*.*) in the Files Of Type combobox in order to do this.

*Select Dialog -> FILTERPARAM -> 1033 from the tree menu on the left of screen.

*The default filter dialog appears. Click with the mouse to choose a control, and use the tab key to cycle through all the available controls. Notice that the preview control and the frame around it are two separate controls.

*Clicking on the preview control should display little blue dots around its edges. Resize the window by clicking near one of these blue dots and moving the mouse until the window is the desired size.

*For super-precise adjustments, you can edit the resource code directly in the text window. Not sure which control is which in the text? Just click on it in the dialog window, and a little red dot will appear next to the appropriate line in the Resource Hacker text window.

*When you're done, click the Compile Script button to update settings, and Hide Dialog to, uhh, hide the dialog.

*Now choose File -> Save As... and save the .8bf file under a new name. All done!

=== Is there a way of changing the about image screen? ===

Yes, but not by using FilterMeister code. You can design the about screen as a Windows Bitmap (BMP) file - 256 color images sized to 342 x 195 pixels seems to work best. You must first compile your plug-in into an 8bf file, then load the 8bf file using [Resource Hacker], which is a free download.

*Run Resource Hacker.

*Go to File -> Open and find your .8bf file. You may need to select All Files (*.*) in the Files Of Type combobox in order to do this.

*Select Action -> Replace Bitmap from the menu. A new dialog should appear.

*Select the bitmap named 134 in the listbox on the right.

*Click on "Open file with new bitmap..." in the top left and locate the BMP file on your computer with the new About screen you have designed.

*If it is the correct bitmap and you're happy with it, click the Replace button on the right.

*Now choose File -> Save As... and save the .8bf file under a new name. All done!

Be sure to play around with Resource Hacker, there's a lot of nifty things you can do with it.

=== How do I prevent the user from resizing the filter dialog window? ===

Using Resource Hacker, you need to change WS_THICKFRAME to DS_MODALFRAME in the main dialog resource (FILTERPARAM -> 1033). This works because Modal dialog windows cannot be resized. You have to do this in your compiled .8BF files - although you can modify FilterMeister itself, the changes won't apply to your compiled plug-ins.

=== How do I create a filter without a dialog? ===

Take a look at the FilterWithoutDialog.ffp source code in the sourcecode/codelibrary directory. The trick is to put doAction(CA_APPLY); at the start of your OnFilterStart section, so the effect is applied immediately.

== Common Coding Errors ==

=== Why aren't X & Y the same as my image's width and height? ===

X and Y are the width & height of the "currently processed image" in the preview window. So if your preview window is zoomed out to 33%, you'll be working with an image 1/3rd the size. You can check the current zoom level with the scaleFactor constant, and you should take the scaleFactor into account in your algorithm if you want your image to look correct at all zoom levels. When you press the OK button, X & Y should always be the same as the image's original width & height. You can learn more about built-in constant values on the Constants page.

=== My plug-in works fine in FilterMeister, but the compiled plug-in hangs ===

Are you dividing by the scaleFactor or zoomFactor variables anywhere in your code? It's possible for these to take the value 0 in the compiled plug-in , so if you're dividing by them you may trigger a divide by zero error... or worse, you might get an infinitely large number. If you've got a for loop somewhere going from 0 to infinity, well, your plug-in is going to hang. The solution is to check if scaleFactor == 0 before you divide by scaleFactor. If scaleFactor is 0, use an alternate equation with 1 in place of scaleFactor.

=== My plug-in behaves strangely from time to time and I can't seem to find the cause. ===

Please check if you initialized important variables to zero. This can be done, e.g., by using instead of

<code>

int MyVariable;

</code>

the following line:

<code>

int MyVariable = 0;

</code>

If a variable wasn't initialized, it doesn't necessarily have a value of zero. It can have a random value and that may not be what your code expects.

=== Does FilterMeister support 16-bit bitdepth images? ===

The most needed functions like src, pget, pset, getArray and putArray support 16-bit values.

=== Why does the filter affect only half of my 16-bit image? ===

You are writing 8-bit values to the 16-bit image buffer. Make sure that you use values ranging from 0 to 32768 and not just 0 to 255.

== General Coding Questions ==

=== How do I make some code run only when the plug-in is first launched, not every time the filter runs? ===

As of recent FilterMeister versions (1.0 Beta 9d), you can use the FME_INIT event to run code the when the plug-in is launched. You need to add the 'initevent' Dialog parameter to your code for this to work. Here us some example code to make work:

<code>

%ffp

Dialog: initevent

OnCtl(n): {

if (e==FME_INIT) {

// Your code would go here

}

return false;

}

</code>