Syphon-Framework icon indicating copy to clipboard operation
Syphon-Framework copied to clipboard

IOSurface Syphon

Open smilingthax opened this issue 3 years ago • 3 comments

PR #56 also contains a SyphonIOSurfaceServer, but SyphonServerBase + SyphonSubclassing.h is already enough to obtain a surface from the server, and to publish it (after drawing into it).

SyphonSubclassing could/should therefore be documented.

smilingthax avatar Aug 25 '22 17:08 smilingthax

SyphonSubclassing.h is already documented. Further discussion of its usage is documented in Syphon.h

What more documentation would be helpful?

bangnoise avatar Aug 25 '22 17:08 bangnoise

Well,

  1. http://syphon.v002.info/FrameworkDocumentation/ does not mention it,
  2. when trying to find a solution to use raw IOSurfaces with Syphon, I did not realise that SyphonSubclassing already provides this possibility (together with SyphonServerBase) and is actually easy to use. I do agree that reading SyphonSubclassing.h gives one the most important information. And
  3. the naming - copySurfaceForWidth:height:options is IMHO not helpful in understanding the appropriate use.

(Interestingly, https://github.com/Syphon/Syphon-Framework/blob/master/SyphonServerBase.m#L2 calls SyphonServerBase actually SyphonIOSurfaceServer.m ...)

Other that that, a developer probably wants to know the IOSurface is (currently) always 32-bit (ARGB) w/ premultiplied alpha.

(As using raw IOSurfaces with Syphon is AFAIUI not encouraged, probably no code sample of how to use it e.g. with a CGBitmapContext should be given (?).)

smilingthax avatar Aug 25 '22 17:08 smilingthax

  1. yes we should update (or delete) the documentation website (move the content of Syphon.h into README.md maybe?)
  2. I'll try to improve visibility of documentation for the not-Metal, not-OpenGL options for custom servers and clients
  3. the name has to begin with 'new' or 'copy' to indicate via Objective C naming conventions that the surface is returned retained. Neither is perfect - perhaps 'new' is better than 'copy'.

I've corrected a couple of comments which had the old name for SyphonServerBase, and documented the surface format - 45ccfcd02b0cea37f20abe3cd5483fd5c313c95b and b147668b6dbbea1619bffa3b2ecb8bc24ade7de4.

bangnoise avatar Aug 25 '22 18:08 bangnoise