Jump to content

Cookies

Members
  • Posts

    112
  • Joined

  • Last visited

Posts posted by Cookies

  1. @Cookie: Could you send me the error log from PDN (if any) from when it crashed?

    No crash log, it just crashed.

    Just tried the new version and after some time of editing the display driver stopped responding (scared me for a second) and it crashed again, still no crash log :(

  2. Cool! I have, in a long time, wanted to make GLSL shaders that could be run in PDN. I might try this later but I'm a bit busy with other things right now. Hope you solve the crashing issue and make it more stable.

  3. Well, as i said above i can only get the correct results if i process the whole image in one run, i tried quite a few things to get it working but for some reason it just dont want to come with the expected result if i dont run it through the whole image like

    ErrorDiffusionSimple eds = new ErrorDiffusionSimple(divisor[DitherMethod], maps[DitherMethod]);
                           eds.ProcessDither(SrcClone, dstArgs.Surface, reg, srcArgs.Bounds, BitDepth);

    which is extremely slow, and this problem only seem to be there with custom UI (only made a fast test from codelab, it ran fine there, and it ran fine before the custom UI) i have been thinking all day without coming closer to a solution, only made changes which change the ouput to even worse when clicking ok :/ and I always forget to make backups

  4. Just some extra info, it tried to copy the class into codelab and test with the default values (not anything loaded from anywhere) it worked fine, when i did the same in my solution it had too much contrast :/

    edit:

    Some comparisons

    my result

    badresult.png

    how it should be more like

    goodresult.png

    edit2: Apparently i don't get the bad result if i run through the image in one run, so i dont know whats causing this :/ any ideas?

  5. Uhm, somewhere in November last year i decided to make a major update to Simulate Color Depth after being somewhere with lots of errors and crashes i got away from it and onto something else. A few days ago i decided to take it up again and decided just to write a whole new easier customizable error diffusion dithering class, success in nearly first try, and as planned i began to add XML support for custom dithers. On my way home from school today my computer had a bluescreen while it was sleeping, but luckily i had my project saved so it wasn't a big problem, so i came home turned on my computer, saw the bluescreen, restarted. Then i worked hard to get the XML stuff working but when i finally worked the result from the error diffusion had too much contrast based on how it was before i implented the XML support, that counts both for the same algorithm called from the data from the XML file and with the values i used before coded in directly, heres the class (default algorithm is Floyd-Steinberg, and the result is long away from what it have been, for a good guidance of how it should look like click here)

        internal class ErrorDiffusionSimple
       {
           const int ERROR = -190;
           int divisor;
           int[][] multiply;
           int boffset = ERROR;
           int foffset = ERROR;
    
           internal ErrorDiffusionSimple()
           {
               divisor = 16;
               multiply = new int[2][];
               multiply[0] = new int[1] { 7 };
               multiply[1] = new int[3] { 3, 5, 1 };
           }
    
           internal ErrorDiffusionSimple(int divisor, int[][] multiply)
           {
               this.divisor = divisor;
               this.multiply = multiply;
           }
    
           internal ErrorDiffusionSimple(int boffset, int foffset, int divisor, int[][] multiply)
           {
               this.boffset = boffset;
               this.foffset = foffset;
               this.divisor = divisor;
               this.multiply = multiply;
           }
    
           internal unsafe void ProcessDither(Surface src, Surface dst, PdnRegion reg, Rectangle rect, int BitDepth)
           {
               int sl = multiply[0].Length;
               int ll = multiply[1].Length;
               for (int y = rect.Top; y < rect.Bottom; y++)
               {
                   for (int x = rect.Left; x < rect.Right; x++)
                   {
                       ColorBgra cp = *(src.GetPointAddressUnchecked(x, y));
                       ColorBgra np = Dithering.GetClosestColor(cp, BitDepth);
                       for (int x2 = x+1; x2 <= x + sl; x2++)
                       {
                           if (reg.IsVisible(x2, y))
                               if (multiply[0][x2-1-x] != 0)
                                   *(src.GetPointAddress(x2, y)) = errorDiffuse(cp, np, *(src.GetPointAddress(x2, y)), multiply[0][x2 - 1 - x]);
                       }
                       for (int y2 = y + 1; y2 < y + multiply.Length; y2++)
                       {
                          for (int x2 = x - (boffset == ERROR ? sl : boffset); x2 <= x + (foffset == ERROR ? sl : foffset); x2++)
                           {
                               if (reg.IsVisible(x2, y2))
                                   if (multiply[y2 - y][x2 + (boffset == ERROR ? sl : boffset) - x] != 0)
                                       *(src.GetPointAddress(x2, y2)) = errorDiffuse(cp, np, *(src.GetPointAddress(x2, y2)), multiply[y2 - y][x2 + (boffset == ERROR ? sl : boffset) - x]);
                           }
                       }
                       *(dst.GetPointAddressUnchecked(x, y)) = np;
                   }
               }
           }
    
           private ColorBgra errorDiffuse(ColorBgra c1, ColorBgra c2, ColorBgra c3, int multiplier)
           {
               int b, g, r;
               b = c1.B - c2.B;
               g = c1.G - c2.G;
               r = c1.R - c2.R;
               return ColorBgra.FromBgr(Clamp(c3.B + ((multiplier *  / divisor)), Clamp(c3.G + ((multiplier * g) / divisor)), Clamp(c3.R + ((multiplier * r) / divisor)));
           }
    
    		private byte Clamp(int 
           {
    			return Convert.ToByte(b < 0 ? 0 : b > 255 ? 255 : ;
           }
       }
    

    Im now sure why it have changed contrast wise but it have (before the bluescreen, custom UI and XML stuff it worked fine and looked quite much, only with minor differences, like the picture i linked to above)

  6. Render rect's coordinates don't always match those of canvas.

    Thererefore y loop starting at y = rect.Top + 1 will cause unpredictable results.

    You could work around though, by using coordinates from Rectangle selection :

    for (int y = selection.Top + 1; y < selection.Bottom - 1; y++)

    Someone will sure present a better solution. :roll:

    I wouldn't do that, if its in an irregular selection (round, shaped) it will do it outside the selection that way

    Ok, lets see: Why can do a "+1" say the program, that it it should calucate each second y-coord/x coord ? (strange)

    I will try it and infomate (? does this word exist) you if its working or not;)

    MfG Whiterock ("MfG" menas in Austria, something like "With friendly Greetings")

    read this: http://www.boltbait....lp/tutorial.asp it explains it

    edit: I guess your trying to avoid going "outside" the image, if so use

    src.GetBilinearSampleClamped(x, y);

  7. Firstly, thanks for answering me Cookies....

    So if an image is saved as a jpeg for instance, I won't be able to un-flatten it - is that correct?

    Is it only PDN and PSD files that support layers?

    Regards

    Greg

    if you save an image as jpeg (or any other filetype where the that dialog comes up) you can right after saving it unflatten it and then save it as PDN, in that way you can have the jpeg file to share/use somewhere and the PDN with the layers so you can edit the individual layers later, but if you close the image after saving it as jpeg without having a layered copy, you can retrieve the layers.

    No, it's not only PDN and PSD that supports layers but im not sure how many other filetype plugins there is else that support layers

  8. Hello Greg, this might answer your questions

    1. It's not possible to unflatten images, save as .PDN to keep your layers and then save as the format you want it to be

    2. i guess this is was you saw flatten.png it tells you that you will be able to unflatten after the image is saved, but not closed and reopened, so you can work with your layers again but you wont be able to retrieve the layers in a non-layer filetype, you can only get your layers again if you save as PDN or PSD or any other filetype that supports layers

  9. What is difference between the already Emboss and Emboss+ plug-in?  I have both in my Stylize menu.  It looks like it's superior, but wanted to know anyway.

    The difference is that this is acting like photoshops emboss (mainly did it for the challenge :P) and instead of being grayscaled this one is more colorful and you can choose height and amount and at last, i wouldn't call it superior ;)

  10. Lately i have been working on an emboss effect which goal was acting like photoshops, i think i ended up with a quite good result. This effect is basically a fragment blur limited to 2 fragments, 1 inverted fragment and 1 normal fragment and it IS based on the fragment blur code since i wouldn't be able to do the angle myself    :P


    UI
    psed[1].png


    Before
    yhsjjie_171[1].png 


    After
    pse[1].jpg 

     

     

    PSEmboss.zip

    • Upvote 2
  11. I got abit bored today (as usual  :P) so i decided to make a blur plugin, this is similar to KrisVDM's Average Blur, but this only takes the average color of the edge of radius, for easier understanding, what this does is that it uses an 8-way symmetry circle algorithm and instead of drawing to the pixels it stores the pixel color and gets the average color of all stored colors.

    AverageEdgeBlur.zip

    UI

    yhsjjie_170.png

     

    original image

    yhsjjie_171.png

     

    blurred image

    yhsjjie_172.png

    • Upvote 1
×
×
  • Create New...