Jump to content

joejoe

Newbies
  • Posts

    6
  • Joined

  • Last visited

Everything posted by joejoe

  1. I mean, I just wanted to play with development of more advanced tools for paint.net which cannot be done with standard plugin template. There is also lack of Paint.NET API documentation, therefore I used to hack Paint.NET source codes, but right now there is no download link any more. I have found this url: http://www.dotpdn.com/downloads/pdnsrc.html , but source codes seems to be gone. It is very easy just to close source codes )-; Qtopia is closed, Google Android is closed, why not to close also Paint.NET )-;
  2. If you working with colors then proper way is using ColorBgra class. (properties .R, .G, .B, .A) ColorBgra srcColor = srcArgs.Surface[x, y]; Byte grayByte = (byte)((double)srcColor.R * 0.299 + (double)srcColor.G * 0.587 + (double)srcColor.B * 0.114); ColorBgra destColor; destColor.R = destColor.G = destColor.B = grayByte; destColor.A = 255; In generally you can use divide, modulo and cast operations. uint intVal = 0xAABBCCDD; byte byteR = (byte)((intVal / (256 * 256 * 256)) % 256); // AA byte byteG = (byte)((intVal / (256 * 256 )) % 256); // BB byte byteB = (byte)((intVal / (256 )) % 256); // CC byte byteA = (byte)((intVal ) % 256); // DD
  3. binaries: http://www.stud.fit.vutbr.cz/~xmlich02/ ... rt_dll.rar source code: http://www.stud.fit.vutbr.cz/~xmlich02/ ... ources.rar screenshots: http://www.stud.fit.vutbr.cz/~xmlich02/ ... .php?id=82 http://www.stud.fit.vutbr.cz/~xmlich02/ ... .php?id=83 http://www.stud.fit.vutbr.cz/~xmlich02/ ... .php?id=84 http://www.stud.fit.vutbr.cz/~xmlich02/ ... php?id=105
  4. I have probably found the solution of my problems with rendering: The rendering loop is probably implemented by a few calls of function Render(...). So when i'm trying to draw text on position defined by pixel inside of this selection, then the letter almost aways is outside of roi rectagles. 1st problem: i cant use Clipping with roi boundaries to clip the text (i have to use different clipping recangle) 2nd problem: Selection is not aways rectangle, but sometimes elipse or any strange shape 3rd problem: Render function is called a few times for one "refresh" (not once for one refresh as i have assumed earlier). So second call of Render function overwrites result of first call, etc. 1st a 2nd problem solution: i'm using self-made checking of boundaries: Rectangle letterRect = new Rectangle(x, y, letter.Width, letter.Height); if (isInside(letterRect, selectionBoundarie)) { drawString(...) } - better solution whould be design pattern map ( int[,] selectionMap = new int[picture.Width, picture.Height]; foreach (x,y) { selectionMap[x,y] = isSelected(x,y) ? 0xFFFF : 0x0;} ), but it's a lot of work and it's not task of effect plugin, it's task of API 3rd problem solution: - i have disabled multiprocessor (multithread) support for this effect plugin -> position of next part of selection shape for rendering function is down in comparsion with previous part of selection shape. - drawString(x, y - Font.Height, ...) So final result of this dicussion is almost done plugin. I have to cleanup source codes - delete messy code, add comments and make some culture in source code at all. After that i will send links for download.
  5. Probably i misundersands how to use clipping rectangles, because when i turn on clipping then no text is rendered. for (int i = startIndex; i < startIndex + length; ++i) { Rectangle rect = rois[i]; dstArgs.Graphics.Clip = new Region(rect); // for (x) { for (y) { if (indexMatrix(x,y)) drawChar(...); }} } I'm using 2 pass method: 1st pass: transform color to grayscale, threshold, store position to matrix and clear destination image. 2nd pass: read matrix with positions and draw text. Overlay is maybe not well definition of problem. Rendered characters are corupted and not readable. When is a good constalation of font size and style, then can i recognise "hello world" string in image, but it's harder than captcha image (-; I've made another experiment with code. Instead of drawing string i'm trying to draw 4x4 filled rectangles. source code for codelab plugin On the image can i see the same problem. There should be blue 4x4px rectangles.
  6. hello all, i'm trying to create asciiArt effect plugin and i don't understand how to draw any text into image. Function Fonts.DrawText putting into image text with some kind of strange alias or overlay. string wholeText = "hello world"; textFont = new Font("Arial", 10); // from FontDialog int characterIndex = 0; string selectedChar = wholeText.Substring(characterIndex,1); Fonts.DrawText( dstArgs.Graphics, textFont, selectedChar, new Point(x - textFont.Height / 3, y - textFont.Height / 2), true, FontSmoothing.Smooth); Example of image created with this plugin: http://www.stud.fit.vutbr.cz/~xmlich02/foto/showDetail.php?id=79 Binnary of this plugin: http://www.stud.fit.vutbr.cz/~xmlich02/AsciiArt_dll.rar Source codes of plugin: [private message, email, &lt;spam&gt;] Can anybody help with this problem?
×
×
  • Create New...