Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Nov 23, 2015
  1. Effects > Artistic > Modern Art: modernize code

    I'll shortly be stealing this code for another function, so I figured
    I'd do some clean-up in advance.
  2. pdWindowSize: fix order of subclassing and size caching

    I believe this fixes a weird problem where certain labels intermittently
    draw incorrectly on their first render, but are fine on subsequent
  3. Unsaved changes dialog: switch to pdLabel

    Now, images with Unicode filenames are displayed correctly by the
  4. Color selection control: new property for hiding "grab main window co…

    …lor" box
    Where space is limited (e.g. the Levels dialog), that feature completely
    blocks the color selector itself, while also being irrelevant.  Now it
    can be toggled on a per-control basis.
Commits on Nov 21, 2015
  1. Clipboard: add internal PD format, many other improvements

    Clipboard interactions should now be lightning-fast, regardless of
    source.  Cut/Copy+Paste from within PD is especially quick thanks to a
    new custom clipboard format that we can use to recognize PD as the
    source of the copy, which allows us to immediately upload our clipboard
    stash right into the program.
    For other formats, I've basically tried to cut out every possible
    intermediary stage in the clipboard pipeline, so regardless of the
    clipboard data's source, PD will do whatever it can to accelerate the
    data load, validate, and parsing steps.
    This commit also fixes some reliability issues with BMP-format clipboard
    data, which may be generated by PrintScreen keypresses, and a few other
    weird edge-cases.
    I think it's finally time to wrap up this clipboard diversion and get
    back to core PD stuff.  If anyone runs into clipboard issues, please do
    let me know, as pretty much all clipboard code has churned over the past
    two weeks and I can only test so many use-cases!
Commits on Nov 20, 2015
  1. Clipboard: implement DIBv5 support

    PD should now interop nicely with just about any other software,
    including alpha-compatible interop with any software capable of
    supporting it.  As before, delayed rendering is used, so PD won't
    clutter up a clipboard with any formats besides those actually requested
    by other software.
    The main outlier at this point is Paint.NET, because Paint.NET is stupid
    and it uses a totally different DIBv5 structure than other software.
    (Premultiplied alpha??  REALLY??)  I have no intention of breaking spec
    (and a bunch of other, well-written software) just to allow interop with
    Paint.NET, so what I'll probably do is look at providing a CF_HDROP
    struct with a link to a temporary file, which may (MAY) allow Paint.NET
    to still work.  Fingers crossed.
    Also, to improve IDE performance, PD will no longer render all clipboard
    formats when closed from within the IDE.  Use the compiled .exe for
    serious work!
Commits on Nov 19, 2015
  1. Implemented delayed rendering for clipboard objects

    Originally, I just wanted to rewrite PD's clipboard class because I was
    using a third-party class from a website known to produce buggy code.
    But one thing led to another, and before I knew it I was reworking the
    whole way PD manages its clipboard interactions.  While I'm "in the
    zone" with clipboard stuff, I may as well go all the way, which leads us
    to this commit.
    Delayed rendering is a cool clipboard trick where you don't actually
    place data on the clipboard until a program actually requests the data.
    For example: PD supports multiple image formats on the clipboard.  If a
    user is editing a 10-megapixel image and they hit "copy", PD needs to
    stick a bunch of 10-megapixel image copies on the clipboard - one copy
    for each supported image format.  This is a lot of work, and it might
    take a few seconds.  Worse still, the clipboard now takes up a ton of
    resources, because it's holding a bunch of massive image copies in
    various formats.
    With delayed rendering, when the user clicks "copy", PD simply tells the
    clipboard "hey - if a program wants PNG, bitmap, DIB, or DIBv5 data, let
    us know."  In addition, PD "stashes" a copy of the current DIB (with
    selections and such processed) to file, in case the on-screen image
    changes between now and when someone hits "Paste".
    Then PD waits.
    If the user switches to another program and hits "Paste", Windows comes
    running back to PD, screaming, "hey - a program wants to paste PD's
    data.  Here's the format they requested."  PD now intercepts that
    message and generates a copy of the requested data on-the-fly, and the
    other program ends up with exactly what it wants.  The clipboard is
    never required to hold more formats than those specifically requested
    since the last "Copy" action, and to the user, this is all handled
    Delayed rendering is a great mechanic, but it's somewhat cumbersome in
    VB since we can't easily trap window messages like WM_DESTROY.
    WM_DESTROY is important because if the user shuts down PD while PD is
    still responsible for clipboard data, PD needs to formally upload all
    supported clipboard data before exiting.  (Otherwise, if the user hits
    "Paste" in some other program, PD won't be around to intercept their
    request!)  So some manual work is required to cover this case, while
    also doing little things like deleting PD's local clipboard stash if
    it's no longer required, reworking "Copy" and "Cut" to pass delayed
    messages, and setting up event handlers to respond to WM_RENDERFORMAT
    Anyway, the take-home message is that "Copy" and "Cut" actions are now
    extremely fast, especially if the user is pasting the data into another
    program.  If they're pasting the data back into PD, performance is still
    mediocre, because when "Paste" is hit, we render a PNG on the fly, then
    decompress it on the fly, which is asinine.  I'll shortly be adding a
    custom PD clipboard format that bypasses all this, making Copy+Paste
    interactions within PD much much faster.
    As part of this work, PD's shutdown sequence was reworked a bit; that's
    why some other random files are included.
Commits on Nov 17, 2015
  1. Convert central clipboard module to class

    Wish I'd done this earlier, since I need to sink clipboard events and I
    want to keep them encapsulated within a dedicated clipboard handler.
Commits on Nov 16, 2015
  1. Clipboard Cut/Copy: continued performance optimizations

    Also, this should fix PD images appearing upside-down when pasting to
    older programs.
  2. pdDIB: heavily optimize alpha premultiplication and compositing

    This will improve performance in many places throughout the program, but
    at present my project of Clipboard cleanup will benefit greatly.
    Copying to the clipboard is now much much faster thanks to this.
  3. Continue unifying UI interaction functions

    Way too many PD functions interact with the UI in unique ways.  These
    need to be consolidated into single Lock/Unlock instances controlled by
    a master function, to ensure consistent behavior.
    This commit is a step in that direction.
  4. FreeImage: add new function for wrapping DIBs without copying them

    FreeImage added this feature in 3.17.0, and it's a great fit for PD
    because it allows us to pass DIBs to FreeImage without doubling our
    memory requirements (or wasting time allocating duplicate chunks of
    image-sized memory).
    I've only added this new feature to Clipboard > Copy for the moment,
    when PD creates PNG clipboard data for interop, but I'll soon be
    replacing other FreeImage interfaces with the new code.  This should
    speed up quite a few things throughout the program.
Commits on Nov 15, 2015
  1. pdClipboard: finish overhaul of DDB, DIB, DIBv5 formats

    What a disastrously complicated project this turned out to be.  The
    clipboard is a hot mess when it comes to the old CF_BITMAP format, and
    trying to find a solution that works without user prompts was not easy.
    The biggest problem with CF_BITMAP is that the pixel data is - by
    definition of a DDB - device-specific.  Modern display drivers typically
    run in 32-bpp mode for performance reasons, but because the alpha bytes
    are irrelevant, you'd expect them to be a nice, obvious value like 0 or
    255.  Unfortunately, depending on the display driver, alpha bytes can be
    all kinds of bizarre values, and short of prompting the user, you have
    no idea if those values are intentional or accidental.
    As such, after a lot of research and testing, PD will now enforce strict
    alpha requirements on DDBs coming from the clipboard - but ONLY if the
    original application actually placed a DDB there.  (If the program
    placed a DIB or DIBv5 on the clipboard, we can now detect that and
    preferentially take the DIB(s) over the DDB.)  Alpha is forced to 255 to
    avoid driver-specific issues with the Print Screen key, so this should
    finally resolve some ugly trouble with screenshots on certain OS + OS
    Theme + video card + driver combinations.
Commits on Nov 14, 2015
  1. Fine-tune vector layer rasterization when merging layers

    Previously, merging a vector layer would cause all vector layers to get
    rasterized.  Now, only the affected layers are rasterized.
Commits on Nov 12, 2015
  1. Edit > Paste now supports Unicode text and URLs

    This allows users to copy+paste files or online images as either formal
    file entries, bare paths, or embedded HTML fragments.  Nice!
    Last up is Bitmap/DIB data, which PD uses as a last resort if no other
    formats are available.
Commits on Nov 11, 2015
  1. Edit > Paste: Unicode file lists now supported

    The only things left to convert to the new system are plaintext
    paths/URLs and DIB/Bitmap data.
Commits on Nov 10, 2015
  1. pdClipboard: a total clipboard interaction overhaul

    The need for this is described in more detail in the pdClipboard
    comments, but basically, PD clipboard interactions leave a lot to be
    desired.  The first step toward solving this is moving away from two
    things: our old, bug-prone vbAccelerator clipboard class (written way
    back in 1998 with switches for 16-bit Windows, ack!), and anything that
    uses the VB Clipboard object.
    This commit solves problem #1.  Clipboard operations that pass through
    pdClipboard are now Unicode-compatible, much better commented, and much
    more reliable (including many fixes for faulty clipboard formats).  HTML
    text is now properly retrieved as UTF-8, global memory allocations are
    now properly flagged, and quite a bit of new functionality has been
    That said, PD's core "Paste" function still relies on some outdated VB
    Clipboard methods.  I'll be migrating those to the new class in the
    coming days, which should fix some long-standing issues like PrintScreen
    bugs on certain combinations of OS+visual theme.
  2. Fix CallNextHookEx declaration (again)

    Many thanks to @Jonney3099 for catching.
Commits on Nov 9, 2015
  1. pdTooltip: fix tooltips obscuring relevant control text

    Drop-down boxes are still a problem, due to API combo boxes being used,
    but that will be fixed when we move to a PD-specific combo box solution.
Commits on Nov 7, 2015
  1. pdAccelerator: a new, PD-specific hotkey solution

    This has been a long-time coming (weird hotkey errors go all the way
    back to #145, #133, etc), but it was particularly prompted by #178,
    which I can't reproduce under any of my OS+hardware combinations.
    The hardest thing about trying to solve accelerator issues is that PD's
    accelerator code is based off a third-party vbAccelerator control which
    I've hacked to pieces over the years.  Rather than continue to hack away
    at it, I think it's time to write a PD-specific accelerator control that
    plays nicely with PD's overall control structure.  Thus this commit.
    A lot of this code was copied over from my old accelerator hacking, but
    I've introduced many more failsafes, including timer-based unhooking
    (which solves the very problematic issue of trying to release a hook
    from within the actual hook proc).  Error handling has been added to
    places where I think it might be relevant, and thankfully, local testing
    hasn't turned up any new errors with this approach (although given the
    complexity of this crap, new errors are certainly possible!).
    I'll keep testing accelerators wherever I can, but if anyone else runs
    into an accelerator-caused error, PLEASE SEND ME YOUR /DATA/DEBUG FOLDER
    as part of the bug report.  That debug data makes all the difference
    when trying to fix bugs I can't reproduce locally.
Commits on Nov 5, 2015
  1. pdCheckBox: complete overhaul

    Not just to integrate ucSupport, but to rethink the whole way the
    control is handled.  The old version was unnecessarily complex, and
    there are better ways to render its UI.
    Also, another 20 GDI objects shaved on cold start due to font sharing
    and removal of unneeded DCs.
  2. Adjustments > Exposure: add offset and gamma, like Photoshop

    Okay, I admit it - sometimes I get bored of tedious UI work!
    This dialog *should* behave the same as Photoshop, but I don't have a
    copy on-hand to test, so I've had to guess at what "offset" and "gamma"
    do.  (But given their names, there's only so many possibilities...)
Commits on Nov 4, 2015
  1. Minor code cleanup

Something went wrong with that request. Please try again.