Jump to content

denverpotsmoker

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by denverpotsmoker

  1. Hello, I'm having problem with a plugin I'm writing (or at least part of the plugin). What this code does is: 01. Looks for a pixel with a red value of 100 02. Writes to a log file the RGB | HSV | Pixel Coordinates That's about it. It works great (thanks to paul_Nicholls for his post "Append to text file from inside CodeLab code"), but the problem is that the log is getting double entries for pixels (averaging 2 entries per pixel). I tested it by: 01. Using a pencil set to R:100. 02. Making one pixel dot onto to standard/default white. 03. Selecting an area. 04. Running the plugin. Nine times out of ten the log file shows 2 entries for the one pixel. This is also true even when only the red pixel is selected. Just wondering if anything can be done to fix this problem. Perhaps paint.net uses overlapping ROI rectangles? I've attached the source code only as you'll want to change the name and location of the log file if you'd like to test it out on your machines. Any help would be appreciated. -Paul // Name: // Submenu: // Author: // Title: // Desc: // Keywords: // URL: // Help: #region UICode int Amount1=0; //[0,100]Slider 1 Description int Amount2=0; //[0,100]Slider 2 Description int Amount3=0; //[0,100]Slider 3 Description #endregion // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Render(Surface dst, Surface src, Rectangle rect) { //START: RENDER CODE int TOP = rect.Top; int BOT = rect.Bottom; int LFT = rect.Left; int RIT = rect.Right; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (int V=TOP; V < BOT; V++) { //START: VERTICAL: TOP TO BOTTOM LOOP (Y) for (int H=LFT; H < RIT; H++) { //START: HORIZONTAL: LEFT TO RIGHT LOOP (X) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ColorBgra CPIX = src[H,V]; Color STDC = CPIX.ToColor(); HsvColor CPHSV = HsvColor.FromColor(STDC); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int CPR = CPIX.R; int CPG = CPIX.G; int CPB = CPIX.B; int CPH = CPHSV.Hue; int CPS = CPHSV.Saturation; int CPV = CPHSV.Value; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (CPR == 100) { //START: CPR IF System.IO.StreamWriter SW; SW = System.IO.File.AppendText("C:\\Users\\CTCPublic\\Desktop\\geb\\CoolEdit.txt"); SW.WriteLine("R:" + CPR + "," + "G:" + CPG + "," + "B:" + CPB + " |" + "H:" + CPH + "," + "S:" + CPS + "," + "V:" + CPV + " |" + "coords=" + "V:" + V + "H:" + H); SW.Close(); } //END: CPR IF // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dst[H,V] = CPIX; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } //END: LEFT TO RIGHT LOOP } //END: TOP TO BOTTOM LOOP // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } //END: RENDER CODE write-tex03.txt
  2. Yeah! This is EXACTLY the type of discussion that is great for our graphics programs. I'd like to see this extend to televisions, where movies are released with their own customized palettes (hopefully based on paint colours available on the commercial market). You know, the BEST place to start with base paints is what is most available (most used) in the agricultural market (ie, the plants used for your palette). For example, some might have a base blue color made from a crop of Woad plant grown in Israel, others might not. I'm sure with non-standardized graphics cards and monitors, it makes all this very difficult. I just think it would be cooler if graphics color was done more like painters, and less like light theorists. en.wikipedia.org/wiki/Tints_and_shades Thanks for the input!
  3. I've been trying to "recreate" a skin for AllMyNotes by changing the colors. The original skin font is shades of gray. I want to change them to green. Due to anti-aliasing, this ends up being many shades of gray which I will make many shades of green (hopefully looking as good as the original but green instead of gray). That said, I tried using HSV...as with the gray colors, mostly just the V changes. With green, I tried to compute how much S would be equivalent. That is: Making Gray Lighter = More V Making Green Lighter = Less S I've even "read up" on HSV color system some. Very mathematical. Didn't really work too well, so now I'll just "eye" the colors. Which made me wonder why this system is used in the first place. In "real life", if one wants a lighter shade of a color, doesn't one usually add white? To make darker, add black? Isn't this is the way painters have done for centuries? Yet this is NOT done in any graphx program (such as Paint.net). Why? You know, if computer color systems were done more like real world painters do it, then perhaps people could learn how to mix colors in the "real world" as they were using the programs to make things for computers. (Just a Thought). Also, why is the color palette so small? I'll just stick with a pdn file and the color picker.
  4. Wow, I didn't know you guys liked the XY so much that you would denigrate someone like that. Not cool! But to get back on topic (since you guys derailed it pretty bad for admins).... I think the whole 2D array for XY/HV is bad. Some people like counting up, then over (VH) and this could easily be fixed by using single variables. I prefer HV (most of the time). .... So fix it already. What's your problem homebrew?
  5. I think the X/Y thing is a left over from that whole NASA-50s-United Nations "one world" thing. You know, one advantage it has is it's "readable" by all languages. I think most languages have an "x" and a "y" in the language, and thus the meaninglessness of the variable names is important (Vertical and Horizontal are probably different in most languages) as when they all get together they can point at it and say "the X trajectory of the nuclear warhead makes me sad."...and EVERYONE in the room will know what he/she is talking about. Still, I like variables that make sense. Strange that X/Y hasn't changed with OOP languages currently prevailing. You know, most OOP programmers like very verbose variables like: number_of_cupcakes = 500 Mine would be NOC = 500 Like that "UP" idea for movement from points tho. H/V = [10,1] UP 5 = [10,6] DN 5 = [10/1] ...good stuff! THX! PS: Somehow using variables in MS-DOS BATCH now seems more reliable to me... %PEACE% + %OUT%
  6. Sorry, must have been (what we in Denver call) "wax typing" on that one. You, know, why Is "X" Horizontal when graphing? That just makes it difficult to figure out. X=H,Y=V, and I say "D" for Density ... now everyone knows what your talking about... I tried some 3D modeling and all I can say is the "Z" axis really got me confused. That said, when I program, I first do things manually. Then, I try to write some code that does the same things I did manually (which is why MS-DOS BATCH missing the PASTE command is soooo upsetting). That said, I think the real test of a programming language is how much I can program the steps to accomplish the algorithm in the same way I would perform the steps manually. Witch is the genius of MENU BATCH! Anywayz...I can work with CodeLab (no prob ...keep up the good work yall, I'll send you some shatter in the mail.
  7. Interesting read. This has given me a "new" idea for BATCH programming...MENU BATCH! All commands are menu commands! All programs (with menus) are batch programmable (somehow). Cool! Here's my codelab COPY rewrite...V=Vertical (Y), H=Horizontal(X) (H,V)=point, TOP/BOT/LFT/RIT ...I hate X,Y, to me it's HVD thanks!
  8. Also, I'm guessing that since the "Paste in to New Layer" isn't available via the script language, that the "Paste in to New Image" is also not available. THX DPS .:.::...:..::::OFF TOPIC::::..:.::.::.:: It's weird, as I'm working on an MS-DOS BATCH program and I noticed there's no PASTE command either. Yeah, just COPY <source> <destination>. Maybe it's an "industry" thing?
  9. Yeah, that's too bad that layer creation can't be handled via script (only through user action). For example, I'm creating a plugin to put a "label" (text) to identify parts of a program skin. For example, it will draw a box around the part of the skin graphic where a button is located and put a label that says something like "Open Button" next to it. It'd be nice if at least the labels could be on a separate layer. I guess I could: 01. Have users make a copy of the skin and put it in a new layer. 02. Have users pick a layer to run my plugin on. 03. Have the plugin delete the skin graphic. 04. Have plugin output the boxes and text. Be nice if you could just script a new layer tho... THX!
  10. From reading, I'm guess there is no way to create a new layer via CodeLab for an Effect? I'd like to: 01. Copy SRC (Layer1 Selection) to new layer (Called Layer2). 02. Run effect code on Layer2. 03. Output DST to Layer2. That way, the original image and effect image will both be present for comparison by the user. Can this even be done with compiled C# code? Just wondering, THX - DPS
×
×
  • Create New...