| Notices | Welcome to RetouchPRO . You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload images and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. | | Software Photoshop, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well. | 
04-03-2006, 12:33 AM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | 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 | 
04-04-2006, 02:38 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 313
| | 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
| 
04-05-2006, 12:10 AM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | | 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 | 
04-05-2006, 05:36 AM
|  | Moderator | | Join Date: May 2004 Location: Goiânia, Brazil
Posts: 1,549
| | 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!
Rô | 
04-05-2006, 12:18 PM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | | 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 | 
04-05-2006, 02:56 PM
|  | Moderator | | Join Date: May 2004 Location: Goiânia, Brazil
Posts: 1,549
| | 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
Rô | 
04-05-2006, 04:27 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 313
| | | 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. | 
04-05-2006, 11:10 PM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | | 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 | 
04-06-2006, 12:11 AM
|  | Senior Member | | Join Date: Jan 2005
Posts: 313
| | | 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. | 
04-06-2006, 05:47 AM
|  | Moderator | | Join Date: May 2004 Location: Goiânia, Brazil
Posts: 1,549
| | 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.
Rô | 
04-06-2006, 12:15 PM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | thanks guys. good to know it's still being worked on.
that 'what's new' page is actually what's in the version i'm using. the setZoom does work. tried it out, but functionally, it doesnt really seem get anything more than what i was getting before before using setZoom. they said '200% larger preview' on the what's new, but i dont really see it, unless it means that what exists now is 200% over what was possible in the earlier versions, which i never had. but it's not a 200% of original image. what i'd love to see is 200% of the original image. then again, i may have implemented it wrong or be looking at it incorrectly.
i tried it like they said, but wasnt quite sure where to put the -888. Code: setZoom(ctl(40));
ctl(40): "Preview Zoom",Range=(-888,16),pos=(305,330)
this did work. it compiled and i got the new 'zoom preview' with a slider to magnify, but it, at the largest size, only takes it to a 100% view.
but again, i'm probably just implementing it incorrectly or thinking about it incorrectly.
craig | 
05-03-2006, 10:06 PM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | | guys,
a question here about FM. does it have the capability to do a color pick from the preview window and if so, could you steer me in that direction? you know, like the eye dropper tool, pick a color and tell you its values or assign it to something.
craig | 
05-04-2006, 09:29 AM
|  | Moderator | | Join Date: May 2004 Location: Goiânia, Brazil
Posts: 1,549
| | Craig,
You can use the chooseColor command, see here for details .
Good luck,
Rô | 
05-04-2006, 09:59 AM
|  | Moderator | | Join Date: Apr 2005 Location: somewhere over there
Posts: 6,570
| | | thanks Ro. that does look like what i was after.
craig | 
05-05-2006, 09:00 AM
| | Junior Member | | Join Date: Apr 2006 Location: Little Silver, NJ
Posts: 17
| | well DAMN. I've got to day this... As a very new member of RTP and a technology-minded, vb script reading digital arts freak... you guys completely amaze me in how much you're willing to share on this forum. Quality... love it. My ears are smoking btw.
Rob |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -6. The time now is 04:37 PM. | |
|