RetouchPRO

Go Back   RetouchPRO > Tools > Software
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Software Photoshop, Lightroom, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well.

FilterMeister - General Info

Reply
 
Thread Tools
  #31  
Old 04-03-2006, 01:33 AM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
Ro,

thank you.

i'd say more in response, but at the moment it's quite late and i wanted to post this for you all. all i can say is that it works. it's sloppy, amatuer, etc, but it does work!

Code:
%ffp

OnFilterstart:{
setDialogPos( true, 50, 50, 550, 200 ); // repositions and resizes dialog window
setDialogColor (RGB(225,56,56));
//setDialogPos( false, -1, -1, 320, 240 ); // centers dialog according to host client area
return true;
}

//OnFilterstart:{
//	setCtlPos(CTL_OK,       420,280, -1, -1);
//	setCtlPos(CTL_CANCEL,   460,280, -1, -1);
//	setCtlPos(CTL_PREVIEW,    5,  5,175,150);
//	setCtlPos(CTL_ZOOM,     200,285, 50, 10);
//	setCtlPos(CTL_PROGRESS,   5,285,185, 10);
//	return false;
// }

ctl(0):"0",size=(*,6),pos=(265,8),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(1):"8",size=(*,6),pos=(265,16),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(2):"16",size=(*,6),pos=(265,24),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(3):"24",size=(*,6),pos=(265,32),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(4):"32",size=(*,6),pos=(265,40),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(5):"40",size=(*,6),pos=(265,48),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(6):"48",size=(*,6),pos=(265,56),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(7):"56",size=(*,6),pos=(265,64),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(8):"64",size=(*,6),pos=(265,72),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(9):"72",size=(*,6),pos=(265,80),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(10):"80",size=(*,6),pos=(265,88),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(11):"88",size=(*,6),pos=(265,96),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(12):"96",size=(*,6),pos=(265,104),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(13):"104",size=(*,6),pos=(265,112),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(14):"112",size=(*,6),pos=(265,120),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(15):"120",size=(*,6),pos=(265,128),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(16):"128",size=(*,6),pos=(410,8),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(17):"136",size=(*,6),pos=(410,16),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(18):"144",size=(*,6),pos=(410,24),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(19):"152",size=(*,6),pos=(410,32),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(20):"160",size=(*,6),pos=(410,40),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(21):"168",size=(*,6),pos=(410,48),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(22):"176",size=(*,6),pos=(410,56),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(23):"184",size=(*,6),pos=(410,64),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(24):"192",size=(*,6),pos=(410,72),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(25):"200",size=(*,6),pos=(410,80),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(26):"208",size=(*,6),pos=(410,88),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(27):"216",size=(*,6),pos=(410,96),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(28):"224",size=(*,6),pos=(410,104),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(29):"232",size=(*,6),pos=(410,112),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(30):"240",size=(*,6),pos=(410,120),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(31):"248",size=(*,6),pos=(410,128),range=(-1000,1000),val=0,color=gray,fontcolor=white,track

ctl(72): PUSHBUTTON, "Reset all to 0",size=(47,14),pos=(484,160),val=0

ForEveryTile:{
int x,y,r,g,b,avg,final,number;
float workingfloat,weight1,weight2;


for (y=y_start; y<y_end; y++){
//if(updateProgress(y,y_end)) abort();
for (x=x_start; x<x_end; x++){

r=src(x,y,0);
g=src(x,y,1);
b=src(x,y,2);

avg=(r+g+b)/3;
//avg=r*0.30 + g*0.59 + b*0.11;

workingfloat=(float)avg/8.50;
// +0.5 for rounding
number=floor(workingfloat+0.5);

// again, +0.5 for rounding
weight1=(workingfloat+0.5)-number;
weight2=1.0 - weight1;

// checking along the way
//final=number*51;
//final=weight1*255;
//final=weight2*255;

// final weighted value
final=avg + ctl(number)*weight2 + ctl(number+1)*weight1;

// write the values back
pset(x,y,0,final);
pset(x,y,1,final);
pset(x,y,2,final);

{
  if  (ctl(72)) setCtlVal(0, 0),setCtlVal(1, 0),setCtlVal(2, 0),
setCtlVal(3, 0),setCtlVal(4, 0),setCtlVal(5, 0),setCtlVal(6, 0),
setCtlVal(7, 0),setCtlVal(8, 0),setCtlVal(9, 0),setCtlVal(10, 0),
setCtlVal(11, 0),setCtlVal(12, 0),setCtlVal(13, 0),setCtlVal(14, 0),
setCtlVal(15, 0),setCtlVal(16, 0),setCtlVal(17, 0),setCtlVal(18, 0),
setCtlVal(19, 0),setCtlVal(20, 0),setCtlVal(21, 0),setCtlVal(22, 0),
setCtlVal(23, 0),setCtlVal(24, 0),setCtlVal(25, 0),setCtlVal(26, 0),
setCtlVal(27, 0),setCtlVal(28, 0),setCtlVal(29, 0),setCtlVal(30, 0),
setCtlVal(31, 0),setCtlVal(72,0);

     return false; }

}} // x y

return true;
} // for every pixel
thanks guys!

craig
Reply With Quote top
  #32  
Old 04-04-2006, 03:38 PM
Stroker's Avatar
Stroker Stroker is offline
Senior Member
 
Join Date: Jan 2005
Posts: 370
Filter Meister uses structures. It took me awhile to wrap my head around these. ForEveryTile and ForEveryPixel are structures. I think of structures as sub-routines that are run in a particular order or when certain things happen.

For pushbuttons, you should use the OnCtl(n) structure. When ever you push a button or whatever, this structure will be run. Within the structure, check to see which button or control was messed with. Then do junk based on that.


Code:
OnCtl(n):{

if  (n==72){ // reset button was pushed
int i;
for(i=0;i<72;i++){setCtlVal(i, 0);} // loop and reset
}// end reset all to 0

return false;
}// end on control
Reply With Quote top
  #33  
Old 04-05-2006, 01:10 AM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
stroker,

thanks.

we used to call what you're calling 'structures', 'functions'. but yes, they are sort of sub-routines or algorythms(sp?). i used what i used there because that's the example i found in the docs and code stuff. it just said 'if (ctl(72) { '. and then followed it with a 'for' or another 'if' (i forget). i didnt know how to do the 'for', so i just did it up in longhand. but yours looks pretty simple. i did see the 'onctl' mentioned, but it wasnt mentioned with pushbuttons, so i just went with the code example.

now, on to the 'for'. you put: "for(i=0;i<72;i++){setCtlVal(i, 0);} // loop and reset" . i understand that it's a loop. that's fine. what i dont understand is the syntax of it. you declared 'i'. ok. and in the 'for' statement you did 'i=0;' . ok, i get that. and i understand the last part, but i dont get the 'i<72;i++)', particularly with it being in conjunction with the i=0. if the whole is a loop, wouldnt the i be reset to 0 each time around in the loop? i get the i is going to not hit 72 (< = less than) and i get that i++ = increment i by 1 each time aruond. but the way i read that code it looks like the 'for' loops i=0 and i<72 and increment i by 1, all on every loop. and if i = 0 each time, then i is never going to reach 31 (the highest n in my ctl's). but that's just the way i understand it based on older codes and what they did. and i can certainly understand that that may not be the case here.

anyways, i can try it and see. but i need to understand how these things work with each other, the syntax and so on.

also, dont the braces { } more or less set a piece of code apart, sort of like the old if-then. if the 'if' tests true you'd jump to a new line. if it was false, you'd simply bypass the rest of the code in the braces. i assume that's still true here (only without the 'then' now).

and what stops the 'for' from looping further, the <72 ? i seem to recall back in the old 8 bit, BASIC days that a 'for' was followed by something the same way the if was always followed by a 'then', but i forget what it was. 'while'? so, what breaks it now? how does the loop know when it's finished?

craig
Reply With Quote top
  #34  
Old 04-05-2006, 06:36 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
Quote:
Originally Posted by Kraellin
we used to call what you're calling 'structures', 'functions'. but yes, they are sort of sub-routines or algorythms(sp?).
Not really.
The correct term is "handler", which gives a good idea of what it is.
This is not ordinary linear (start here - end there) programming, this is more "object orientated". Which means that each handler gets called in response to something happening.
The easiest handler to understand is OnCtrl(n), this gets invoked whenever you fiddle with a control - other than that it doesn't run.
Unfortunately, unless I missed something, FM does not have any provision for sub-routines or functions.

Quote:
Originally Posted by Kraellin
now, on to the 'for'. you put: "for(i=0;i<72;i++){setCtlVal(i, 0);} // loop and reset" . i understand that it's a loop. that's fine. what i dont understand is the syntax of it....but the way i read that code
Aha! But that isn't code. I can see what you're saying though. The three parts in the brackets are not code lines, it's just a convenient (although it seems, slightly confusing) way of grouping all the parameters of the "for" loop:
a) Start from zero;
b) Do while less than 72;
c) Increment by one on each pass
Quote:
Originally Posted by Kraellin
also, dont the braces { } more or less set a piece of code apart, sort of like the old if-then. if the 'if' tests true you'd jump to a new line. if it was false, you'd simply bypass the rest of the code in the braces. i assume that's still true here (only without the 'then' now).
Braces serve to group various lines of code as if it were one. Normally with an "if" or "for" command you will want to group some code. Actually I find the exception, where there is only one line, more confusing - stroker's code..
Code:
for(i=0;i<72;i++){setCtlVal(i, 0);}
can be written without the braces..
Code:
for(i=0;i<72;i++) setCtlVal(i, 0);
without problem. Although in the middle of a page of code you'll have to look carefully - especially if it isn't properly indented.
Quote:
Originally Posted by Kraellin
and what stops the 'for' from looping further, the <72 ? i seem to recall back in the old 8 bit, BASIC days that a 'for' was followed by something the same way the if was always followed by a 'then', but i forget what it was. 'while'? so, what breaks it now? how does the loop know when it's finished?
see a), b), c) above. It's all rolled into the "for" loop parameters.

Hope that cleared it up.
Any questions, just fire away!

Reply With Quote top
  #35  
Old 04-05-2006, 01:18 PM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
Ro,

thanks.

ok, grouped parameters. i can live with that. thus, it is the <72 that defines the end of the loop. and the ';' is simply demarking the end of a given parameter, but like you said, it's not linear. ok. so, the handler simply understands all this and handles things accordingly. would it matter the order then of the various parameters? is there a specified syntax to that? if it's not linear, i would think it wouldnt matter, but then again, if the handler is set up to look for certain things first, then it would.

so are 'if's the same way as the 'for's?

craig
Reply With Quote top
  #36  
Old 04-05-2006, 03:56 PM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
Quote:
Originally Posted by Kraellin
...would it matter the order then of the various parameters? is there a specified syntax to that?
Order does matter. Initial - Ending condition - Increment. As to syntax, I usually stick to the simple stuff (like (i=0;i<72;i++)) - I don't know how far you can complicate the parameters.
Quote:
Originally Posted by Kraellin
so are 'if's the same way as the 'for's?
In general structure, yes. After the "If" there's a condition* inside the brackets, and after that one line of code or various lines enclosed in braces.
After the "If" code is all finished you can optionally add an "Else" section.

*something that returns a true/false value

Reply With Quote top
  #37  
Old 04-05-2006, 05:27 PM
Stroker's Avatar
Stroker Stroker is offline
Senior Member
 
Join Date: Jan 2005
Posts: 370
There are shortcuts to the basic math functions.

i=i+1
is the same as
i++

This is why you usually see i++ in the for loops.

i=i+j
is the same as
i+=j


for( initial state ; conditional ; incremental )
{
// statements
}

Like Ro said.

In the conditional, using < or <= may make a difference. I haven't completely figured this out. Sometimes a loop will go one beyond and sometimes it will behave just fine. Even in BASIC, I've had to break for/next loops early because of One Beyond Syndrome.

I think FM does support do/while and while/wend loops. I avoid them because it's easy for me to plant a logic bomb when I use them. I can handle logic bombs, but these ones throw me for a... loop. ~snicker~

Indenting - ugh! I was never one for proper indenting because I have the hardest time reading code with indents. Once in a great while I might indent properly if my nested conditionals get uber hairy. I'm trying to be better about it. Honestly.

Crud. I lost my train of thought.
Reply With Quote top
  #38  
Old 04-06-2006, 12:10 AM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
thanks stroker. still studying, but all that does help.

also, anyone know if FM is still being developed? would love to see a greater zoom and an increase in ctl numbers (docs say it's currently limited to 60).

craig
Reply With Quote top
  #39  
Old 04-06-2006, 01:11 AM
Stroker's Avatar
Stroker Stroker is offline
Senior Member
 
Join Date: Jan 2005
Posts: 370
FM is still being developed. Alex and Harald, I believe.
- zooming in
- user defined functions
- dll linking
- Perlin Noise function

And some other things I can't remember right now.

I think the limit on controls is more than 60. Like 0 to 255.
Reply With Quote top
  #40  
Old 04-06-2006, 06:47 AM
byRo's Avatar
byRo byRo is offline
Senior Member
 
Join Date: May 2004
Location: Goianésia, Brazil
Posts: 1,609
Quote:
Originally Posted by Kraellin
.....anyone know if FM is still being developed?
Go to the FM home page http://www.filtermeister.com/ , select "Documents", then "FilterMeister Wiki" then "New in FM 1.0". There you'll find a (long) list of developments. Maybe interesting reading.

Reply With Quote top
Reply

  RetouchPRO > Tools > Software


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Important security info chrishoggy Salon 11 02-16-2007 03:31 PM
scratch info in info palette seanarmenta Photoshop Help 5 08-11-2006 09:32 PM
Using info from green channel, any help? RobArnold Image Help 8 12-07-2005 07:04 AM
File > File Info - Does Elements have this menu command? DannyRaphael Photoshop Elements Help 5 07-26-2004 08:18 PM
Mend Tool - Patron Info button error. jimlay Hidden Power Support 6 02-29-2004 01:49 PM


All times are GMT -6. The time now is 04:05 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved