1 Reply
      Latest reply on Aug 12, 2019 2:22 PM by Ken Thomases
      oneeyeman1 Level 1 Level 1 (0 points)

        "Hi, ALL,

        On Windows there is a call to BitBlt() which takes a "raster operation" as a parameter.

        The list for those operations can be found at https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-bitblt.

         

        As far as I understand for Coca this correspond to this: https://developer.apple.com/documentation/coregraphics/cgblendmode?language=objc

         

        Is there a clean way to map those Windows operation to Cocoa?

         

        Or maybe I'm looking at the wrong Cocoa docs?

         

        Please advise.

         

        BTW, the Apple link mentions that there is an "PDF Reference, Fourth Edition, Version 1.5, Adobe Systems, Inc.", but the page does not provide a link to the document itself.

         

        Unless this information is outdated and there is a newer document available somewhere.

         

        Thank you.

        • Re: Raster operation
          Ken Thomases Level 4 Level 4 (745 points)

          Blend modes are somewhat similar in purpose to those raster ops, but not directly mappable. Neither Cocoa nor Core Graphics has an exact analog for raster ops.

           

          The issue is that raster ops operate on the pixel value as a bit pattern, with bitwise AND, OR, XOR operations. Core Graphics works with color values without regard to how those colors are represented in the bitmap. So, red, green, and blue have values between 0 and 1 and blend modes can add, subtract, multiply, etc. those values, but can't operate bitwise on them.

           

          If you need those bitwise raster ops, you'll have to implement them in software by directly accessing the bits of the bitmap.