Pivot
  1. Pivot
  2. PIVOT-843

Copy Paste issues with CF_DIB clipboard type image

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0, 2.0.1, 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: None
    • Environment:
      Windows 7

      Description

      Copying and Pasting an image that is of the windows specific CF_DIB clipboard format, causes the image to split about 1/3rd and then re-attached to the remainder of the image. I have been able to locate some previously coded free-standing java code to copy and paste CF_DIB clipboard images. Maybe that code can be incorporated into Pivot to solve this issue?

      1. AC_Pano.dib
        3.01 MB
        Arindam
      2. AC_Pano.jpg
        437 kB
        Arindam
      3. AC-CutnPaste.jpg
        331 kB
        Arindam
      4. AC Pano1.dib
        570 kB
        Sandro Martini
      5. CF_DIB Clipboard Java.zip
        6 kB
        Arindam
      6. clipboard.bxml
        5 kB
        Sandro Martini
      7. pivot_843_sample_output_from_test_app_before_the_fix.jpg
        65 kB
        Sandro Martini
      8. pivot_843_test.dib
        570 kB
        Sandro Martini
      9. Re_ [Phil's Notes] Comment_ _Blog Revivified_.pdf
        575 kB
        Arindam

        Activity

        Hide
        Sandro Martini added a comment -

        For many reasons (see discussion inside the issue) it's not a Pivot problem, and this is something we cant't (even for licenses, unwanted dependencies, etc) fix in Pivot.

        Maybe in pivot-contrib, in a dedicated subproject, so we keep in touch with the issue creator (Arindam) to explore if/how to do the fix there.

        Show
        Sandro Martini added a comment - For many reasons (see discussion inside the issue) it's not a Pivot problem, and this is something we cant't (even for licenses, unwanted dependencies, etc) fix in Pivot. Maybe in pivot-contrib, in a dedicated subproject, so we keep in touch with the issue creator (Arindam) to explore if/how to do the fix there.
        Hide
        Sandro Martini added a comment -

        Solution Pivot-oriented (but for sources Pivot):

        • implement your own version of Clipboard (maybe starting by copying org.apache.pivot.wtk.Clipboard), to use only with this kind of images
          • the point for the workaround is the method public static Manifest getContent()
        • implement your own version of RemoteManifest, and call it from the previous method
          • the point here is the method public Image getImage()

        Note that the proposed fix that uses eclipse SWT is aligned with this solution.

        Then for example you could test all this by calling (your version of Clipboard) from Javascript embedded in bxml, like pivot_843.bxml.

        After looking better at Clipboard and related classes I have to say that I'm sorry but it has many static methods and variables, so we can't do so much without breaking compatibility ... so I'll close this issue for Pivot (but finish to commit test files). And if you agree, we can continue together under pivot-contrib ... tell me if/when you are ready.

        Otherwise, you can work on a more Java AWT-oriented solution (where the rela problem is), like working on DataFlavors available on this clipboard (see addFlavorListener), but I'm sorry, I can't say you so much on this.

        Be free to post here some update.
        Thanks for now.

        Show
        Sandro Martini added a comment - Solution Pivot-oriented (but for sources Pivot): implement your own version of Clipboard (maybe starting by copying org.apache.pivot.wtk.Clipboard), to use only with this kind of images the point for the workaround is the method public static Manifest getContent() implement your own version of RemoteManifest, and call it from the previous method the point here is the method public Image getImage() Note that the proposed fix that uses eclipse SWT is aligned with this solution. Then for example you could test all this by calling (your version of Clipboard) from Javascript embedded in bxml, like pivot_843.bxml. After looking better at Clipboard and related classes I have to say that I'm sorry but it has many static methods and variables, so we can't do so much without breaking compatibility ... so I'll close this issue for Pivot (but finish to commit test files). And if you agree, we can continue together under pivot-contrib ... tell me if/when you are ready. Otherwise, you can work on a more Java AWT-oriented solution (where the rela problem is), like working on DataFlavors available on this clipboard (see addFlavorListener), but I'm sorry, I can't say you so much on this. Be free to post here some update. Thanks for now.
        Hide
        Sandro Martini added a comment -

        Add a screenshot to show both the original image open in Paint, and after the Paste in the Test Pivot application, BEFORE the fix.

        Show
        Sandro Martini added a comment - Add a screenshot to show both the original image open in Paint, and after the Paste in the Test Pivot application, BEFORE the fix.
        Hide
        Sandro Martini added a comment -

        Small resolution version of the sample dib file.

        To test the issue, in Windows:
        open this image with some imaging tool (like Paint) and copy the image in memory (maybe select only the image portion of it), then do the Paste from inside the test application (pivot_843.bxml, under tests).

        Show
        Sandro Martini added a comment - Small resolution version of the sample dib file. To test the issue, in Windows: open this image with some imaging tool (like Paint) and copy the image in memory (maybe select only the image portion of it), then do the Paste from inside the test application (pivot_843.bxml, under tests).
        Hide
        Sandro Martini added a comment - - edited

        In Pivot-Common under apache-extras ( http://code.google.com/a/apache-extras.org/p/pivot-common/ ) I created the eclipse project pivot-swt-dependencies , with inside all SWT jars from eclipse-3.7.2 for windows and linux, just for convenience to use in a build environment and not as a download location (you'll have to download them from eclipse web site to use them).

        So the workaround for this (JVM issue) could be done as suggested in the files in attach, but not as Pivot core code (in pivot-contrib for example, in a dedicated subproject).
        Arindam, if you want I'll give your write right there, I could even create the skeleton project for you there ... tell me if/when you are ready.

        Now for Pivot, I'll look what we can do to enable this (outside) code to work and solve the issue.

        Show
        Sandro Martini added a comment - - edited In Pivot-Common under apache-extras ( http://code.google.com/a/apache-extras.org/p/pivot-common/ ) I created the eclipse project pivot-swt-dependencies , with inside all SWT jars from eclipse-3.7.2 for windows and linux, just for convenience to use in a build environment and not as a download location (you'll have to download them from eclipse web site to use them). So the workaround for this (JVM issue) could be done as suggested in the files in attach, but not as Pivot core code (in pivot-contrib for example, in a dedicated subproject). Arindam, if you want I'll give your write right there, I could even create the skeleton project for you there ... tell me if/when you are ready. Now for Pivot, I'll look what we can do to enable this (outside) code to work and solve the issue.
        Hide
        Sandro Martini added a comment -

        add another example, smaller than the other

        Show
        Sandro Martini added a comment - add another example, smaller than the other
        Hide
        Sandro Martini added a comment -

        Test: Update clipboard bxml file (under tutorials) to add AC_Pano.jpg image and try to copy/paste from inside a Pivot application ... and in this case all works good.

        Show
        Sandro Martini added a comment - Test: Update clipboard bxml file (under tutorials) to add AC_Pano.jpg image and try to copy/paste from inside a Pivot application ... and in this case all works good.
        Hide
        Arindam added a comment -

        That's what I was surprised to find out as well. I am on 1.6.0_30. I tried this with another app called ImageJ and same results with the CIF_DIB type images. The standalone code from Phillip Schatz, that I modified a bit (though it references Eclipse), works.

        Show
        Arindam added a comment - That's what I was surprised to find out as well. I am on 1.6.0_30. I tried this with another app called ImageJ and same results with the CIF_DIB type images. The standalone code from Phillip Schatz, that I modified a bit (though it references Eclipse), works.
        Hide
        Noel Grandin added a comment -

        The weird thing about this bug for me is that a little googling indicates that java should have built conversion for CIF_DIB images.

        What version of Java are you running Arindam?

        Show
        Noel Grandin added a comment - The weird thing about this bug for me is that a little googling indicates that java should have built conversion for CIF_DIB images. What version of Java are you running Arindam?
        Hide
        Arindam added a comment -

        Any thoughts from anyone else on this last idea from Sandro? Is that doable as this seems to be the only alternative at this point? Or am I missing the point?

        Thanks.

        Show
        Arindam added a comment - Any thoughts from anyone else on this last idea from Sandro? Is that doable as this seems to be the only alternative at this point? Or am I missing the point? Thanks.
        Hide
        Sandro Martini added a comment -

        Another idea ... we could try instead to see in Pivot on how to let Arindam use the code without having to include it in core Pivot (and so maybe neither in Pivot-Contrib or put there in the future, but this is not the point):
        verify if/what changes we can do in Clipboard handling to let outside code set external handlers ... but I'm writing this just as idea (without looking at our code).
        The only problem I see in this approach is that small changes (or additions) could be done for 2.0.x maintenance, but api changes could be done only for 2.1.0 or later releases, to avoid compatibility problems.

        What do you think on this (other Pivot Developers, with more experience than me in that part of code) ?

        I think that for now this could be the only real option to let Arindam solve this issue in his application.

        Show
        Sandro Martini added a comment - Another idea ... we could try instead to see in Pivot on how to let Arindam use the code without having to include it in core Pivot (and so maybe neither in Pivot-Contrib or put there in the future, but this is not the point): verify if/what changes we can do in Clipboard handling to let outside code set external handlers ... but I'm writing this just as idea (without looking at our code). The only problem I see in this approach is that small changes (or additions) could be done for 2.0.x maintenance, but api changes could be done only for 2.1.0 or later releases, to avoid compatibility problems. What do you think on this (other Pivot Developers, with more experience than me in that part of code) ? I think that for now this could be the only real option to let Arindam solve this issue in his application.
        Hide
        Sandro Martini added a comment -

        Licensing review of the code in attach:

        • the code has not a license in every (nor in any) source file, so should see (with the original author) if the Apache license is good for him (but I think yes)
        • the code belongs to Philip Schatz ( www.philschatz.com ), and in the PDF in attach I see that he said to Arindam that he/we could use his code, but I don't think this is enough at ASF to accept the code, but following these rules should help to fix this part of the discussion:
          http://incubator.apache.org/ip-clearance/index.html
          Of course I could handle all this (trying to contact Philip, etc), but we have to see if he wants/is interested in doing this.
          And of course this is a blocker for all the following points, even for accepting this code under one of our Pivot-related subprojects under Apache-Extras.
        • the code has some dependencies to Eclipse SWT which is licensed under the EPL license, so look here for Eclipse license compatibility with the Apache License v2:
          See "EPL 1.0" under http://www.apache.org/legal/resolved.html#category-b
          but on this licenses are compatible so there shouldn't be problems
        • BUT the problem is here (and it's a question that arise some times during last years):
          we can't (or better, don't want to) have dependencies to eclipse libraries in core Pivot due to their complexities etc ... and the same for other complex libraries.
          So this is a blocker for adding this inside Pivot core.

        But one time solved all previous points we could think to put that code under pivot-contrib ( http://code.google.com/a/apache-extras.org/p/pivot-contrib/ ) in a dedicated subproject ... or better, I could add Committer grants directly to Arindam and/or Philip and let him/them commit there.
        Like what already done in the guretzki subproject there.

        I'm sorry for raising all these problems, but it's better now (before doing things) than later ... and licensing issues here at ASF are really important things (as should be generally speaking).

        Comments ?

        Show
        Sandro Martini added a comment - Licensing review of the code in attach: the code has not a license in every (nor in any) source file, so should see (with the original author) if the Apache license is good for him (but I think yes) the code belongs to Philip Schatz ( www.philschatz.com ), and in the PDF in attach I see that he said to Arindam that he/we could use his code, but I don't think this is enough at ASF to accept the code, but following these rules should help to fix this part of the discussion: http://incubator.apache.org/ip-clearance/index.html Of course I could handle all this (trying to contact Philip, etc), but we have to see if he wants/is interested in doing this. And of course this is a blocker for all the following points, even for accepting this code under one of our Pivot-related subprojects under Apache-Extras. the code has some dependencies to Eclipse SWT which is licensed under the EPL license, so look here for Eclipse license compatibility with the Apache License v2: See "EPL 1.0" under http://www.apache.org/legal/resolved.html#category-b but on this licenses are compatible so there shouldn't be problems BUT the problem is here (and it's a question that arise some times during last years): we can't (or better, don't want to) have dependencies to eclipse libraries in core Pivot due to their complexities etc ... and the same for other complex libraries. So this is a blocker for adding this inside Pivot core. But one time solved all previous points we could think to put that code under pivot-contrib ( http://code.google.com/a/apache-extras.org/p/pivot-contrib/ ) in a dedicated subproject ... or better, I could add Committer grants directly to Arindam and/or Philip and let him/them commit there. Like what already done in the guretzki subproject there. I'm sorry for raising all these problems, but it's better now (before doing things) than later ... and licensing issues here at ASF are really important things (as should be generally speaking). Comments ?
        Hide
        Arindam added a comment -

        When I copy and paste AC_Pano.dib into Pivot, the image distortion happens. But if you open it up in Paint, copy and paste it into the window by running the code that I attached, it pastes perfectly.

        Attached also is the permission from the initial creator of the code to grant its usage as per ASF/Apache license rules.

        Show
        Arindam added a comment - When I copy and paste AC_Pano.dib into Pivot, the image distortion happens. But if you open it up in Paint, copy and paste it into the window by running the code that I attached, it pastes perfectly. Attached also is the permission from the initial creator of the code to grant its usage as per ASF/Apache license rules.
        Hide
        Sandro Martini added a comment -

        Hi,
        yes if you have some code and/or a patch for this and you want to publish under the apache license you are welcome to send to us, but in the following way (by Apache rules): attach here all files (maybe inside a zip), and verify to have the "Grant for inclusion in ASF work" (or similar) enabled so we can use it

        Note that if you instead have a patch (in standard diff format, for example done in eclipse) it would be even better, only remember to update to latest trunk before doing it so our merge will be simpler ... and if possible, to generate it with all paths relative to the full workspace.

        And last, if possible, could you attach (with the same flag for grant enabled) even a sample image in the CF_DIB clipboard format, so we can make a small test to verify ? Otherwise you should try and tell us if/when this issue it's resolved.

        Thank you for now, keep us updated.

        Show
        Sandro Martini added a comment - Hi, yes if you have some code and/or a patch for this and you want to publish under the apache license you are welcome to send to us, but in the following way (by Apache rules): attach here all files (maybe inside a zip), and verify to have the "Grant for inclusion in ASF work" (or similar) enabled so we can use it Note that if you instead have a patch (in standard diff format, for example done in eclipse) it would be even better, only remember to update to latest trunk before doing it so our merge will be simpler ... and if possible, to generate it with all paths relative to the full workspace. And last, if possible, could you attach (with the same flag for grant enabled) even a sample image in the CF_DIB clipboard format, so we can make a small test to verify ? Otherwise you should try and tell us if/when this issue it's resolved. Thank you for now, keep us updated.
        Hide
        Arindam added a comment -

        AC_Pano.jpg is the normal jpg. Copying and pasting that into Pivot results in AC-CutnPaste.jpg. If AC_Pano. jpg is used to test, it will probably not give the error as it is not a CF_DIB format image.

        Show
        Arindam added a comment - AC_Pano.jpg is the normal jpg. Copying and pasting that into Pivot results in AC-CutnPaste.jpg. If AC_Pano. jpg is used to test, it will probably not give the error as it is not a CF_DIB format image.

          People

          • Assignee:
            Sandro Martini
            Reporter:
            Arindam
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development