Jump to content
Paint.NET 5.1 is now available! ×

Recommended Posts

Posted

Hi,

I have no clue how to program a plugin which saves coordinates in a textfile of an object which is detectet by an algorithm.

Can you help me, how i realize the part of saving the coordinates?

regards

tobi

Posted

Or, sabrown100, you could answer the question. :roll:

I have no idea (not a programmer), so I can't. :-)

But he is correct. You should make your thread title more unique. Look at the rules (specifically number 6)

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Posted

You should be more patient.

Nobody here is 'at your service, Sir!'

This is an example of code you could reuse to create a text file within an effect type plugin (not a file type).

// Part of code to include in a code for plugin
// to "debug.print" some values in a text file.
// This code alone isn't working!
using System.IO;

[ThreadStatic]
public static bool init = false;
// maybe also declare these varibles as public static!!
public static int margT = -1, margB = -1, margR = -1, margL = -1;

if (!init)
{
 //==========================================
 // calculating process should be here !
 // Example:
 margT = -1; margB = -1; margR = -1; margL = -1;

 // Loop through all the pixels to find Left/Right/Top/Bottom
 // position of an object (something in a transparent area)
 for (int y = selection.Top; y < selection.Bottom; y++)
 {
   for (int x = selection.Left; x < selection.Right; x++)
   {
     CurrentPixel = src[x, y];
     if (CurrentPixel.A > 0) 
     {
       if (margR == -1) { margR = MinX; } else if (x > margR) { margR = x; }
       if (margL == -1) { margL = MaxX; } else if (x < margL) { margL = x; }
       if (margB == -1) { margB = MinY; } else if (y > margB) { margB = y; }
       if (margT == -1) { margT = MaxY; } else if (y < margT) { margT = y; }
     }
   }
 }
 // end of calculating process
 //==========================================

 // This will always rewrite (write over) the file c:\temp\debugtext.txt
 using (StreamWriter streamWriter = new StreamWriter("c:\\temp\\debugtext.txt"))
 {
   streamWriter.WriteLine(String.Concat("//margin Left  :", margL));
   streamWriter.WriteLine(String.Concat("//margin Right :", margR));
   streamWriter.WriteLine(String.Concat("//margin Top   :", margT));
   streamWriter.WriteLine(String.Concat("//margin Bottom:", margB));
   streamWriter.Close();
 }
 init = true;
}

You could provide your code if you want more help!

Posted

no, not u or pnd sucks.

my idea sucks.

i realized now a c# project.

i think its better for my requirements and easier to program...

so long

stay tuned

Posted

to ur info, :wink:

i wanted a plugin, that get svg coordinates from a normal bmp.

my problem was the override render method.

This Method overwrites the svg file every time with the new catched coordinates.

And the algorithm to recognize the edges was just to long for a plugin i think.

regards

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