2 Replies Latest reply on Mar 31, 2011 6:54 PM by 851713

    Own ColorModel setup question


      I read the book "Filthy Rich Clients" which is very usefull for Java2D and Animations.

      At the image filter section I found the following :
      DirectColorModel directCM = new DirectColorModel(32,
                          0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
                  dst = createCompatibleDestImage(src, directCM);
      This create a new ColorModel with Red/Green/Blue/Alpha-values ?
      Why someone change the direction from ARGB to RGBA ?
      Are there any advantages?


        • 1. Re: Own ColorModel setup question
          Some files come ARGB and some come RGBA. If I make it, I use ARGB or if it comes ARGB I leave it as ARGB. If it comes RGBA then I manipulate it as an RGBA, I don't convert it. It may come down to the environment you code for, does your destination graphics support ARGB or RGBA?
          1 person found this helpful
          • 2. Re: Own ColorModel setup question

            Sorry I misunderstand the constructor.
            Now after I do read the javadoc of DirectColorModel it becomes clear.
            The alpha bits are the last argument.

            So the code did not change the direction as I suggested.

            Thanks for your hint. I read something about the color spaces in the book.
            From the SwingX-library there comes a usefull class named GraphicsUtilties where you can create
            a system-graphic-device-compatible image, not wondering about what type this is.