
    
3j+#                    ^   % S r SSKJr  SSKrSSKrSSKrSSKrSSKJrJrJ	r	J
r
JrJrJrJrJrJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  \(       a  SSKJr  SSKJrJ r J!r!  Sr"S/r#Sr$Sr%Sr&Sr'\%\'-  \&-  r(S\)S'    " S S\5      rS$S jr* " S S\5      r+ " S S\5      r, " S S\5      r-S\/\4S\/\-4S\/\	4S\/\" \5      4S\/\4S\/S4S\\" \5      \" \5      /\4S\/\4S\/\4S\/\4S\/\4S\/\4S\-/\-4S\-\-/\-4S\-\\\/\4S.r.S \)S!'    " S" S#\5      r/g)%zmacOS CoreGraphics backend for MSS.

Uses the CoreGraphics APIs to capture windows and enumerates up to
``max_displays`` active displays.
    )annotationsN)
POINTER	Structurec_doublec_floatc_int32c_longc_size_tc_ubytec_uint32c_void_p)mac_ver)TYPE_CHECKING)MSS)MSSImplementation)ScreenShotError)Size)Any)
CFunctionsMonitorMonitors)IMAGE_OPTIONSr   defaultgRQ$@         intr   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r   4   zKDeprecated macOS compatibility constructor.

Use :class:`mss.MSS` instead.
c               Z   > [         R                  " S[        SS9  [        TU ]  " S0 UD6  g )NzMmss.darwin.MSS is deprecated and will be removed in 11.0; use mss.MSS insteadr   )
stacklevel )warningswarnDeprecationWarningsuper__init__)selfkwargs	__class__s     D/home/wildlama/miniconda3/lib/python3.13/site-packages/mss/darwin.pyr'   MSS.__init__:   s*    [	

 	"6"    r"   )r)   r   returnNone)__name__
__module____qualname____firstlineno____doc__r'   __static_attributes____classcell__r*   s   @r+   r   r   4   s    
# #r-   r   c                 B    [         R                  S:  a  [        $ [        $ )z&Get the appropriate value for a float.l        )sysmaxsizer   r   r"   r-   r+   cgfloatr;   D   s    {{U*877r-   c                  F    \ rS rSrSrS\" 5       4S\" 5       44rSS jrSrg)	CGPointI   z3Structure that contains coordinates of a rectangle.xyc                f    [        U 5      R                   SU R                   SU R                   S3$ )Nz(left=z top=))typer0   r?   r@   r(   s    r+   __repr__CGPoint.__repr__N   s.    t*%%&fTVVHE$&&CCr-   r"   Nr.   str	r0   r1   r2   r3   r4   r;   _fields_rE   r5   r"   r-   r+   r=   r=   I   s#    =gi 3	"23HDr-   r=   c                  F    \ rS rSrSrS\" 5       4S\" 5       44rSS jrSrg)	CGSizeR   z3Structure that contains dimensions of an rectangle.widthheightc                f    [        U 5      R                   SU R                   SU R                   S3$ )Nz(width=z height=rB   )rC   r0   rN   rO   rD   s    r+   rE   CGSize.__repr__W   s.    t*%%&gdjj\$++aPPr-   r"   NrG   rI   r"   r-   r+   rL   rL   R   s#    =')$x&;<HQr-   rL   c                  2    \ rS rSrSrS\4S\44rSS jrSr	g)	CGRect[   z6Structure that contains information about a rectangle.originsizec                f    [        U 5      R                   SU R                   SU R                   S3$ )N< >)rC   r0   rU   rV   rD   s    r+   rE   CGRect.__repr__`   s.    t*%%&a}Adii[BBr-   r"   NrG   )
r0   r1   r2   r3   r4   r=   rL   rJ   rE   r5   r"   r-   r+   rS   rS   [   s    @7#ff%56HCr-   rS   core)CGDataProviderCopyDataCGDisplayBoundsCGDisplayRotationCFDataGetBytePtrCFDataGetLength	CFReleaseCGGetActiveDisplayListCGImageGetBitsPerPixelCGImageGetBytesPerRowCGImageGetDataProviderCGImageGetHeightCGImageGetWidthCGRectStandardizeCGRectUnionCGWindowListCreateImager   
CFUNCTIONSc                  t   ^  \ rS rSrSrSS1rSSS.SU 4S jjjrSS	 jrSS
 jrSS jr	SS jr
SS jrSrU =r$ )MSSImplDarwin}   a  Multiple ScreenShots implementation for macOS.
It uses intensively the CoreGraphics library.

:param max_displays: maximum number of displays to handle (default: 32).
:type max_displays: int

.. seealso::

    :py:class:`mss.MSS`
        Lists other parameters.
r\   max_displaysr       )backendrp   c                  > [         TU ]  5         US:w  a  Sn[        U5      eX l        U R	                  5         U R                  5         g )Nr   z5The only valid backend on this platform is "default".)r&   r'   r   rp   _init_library_set_cfunctions)r(   rr   rp   msgr*   s       r+   r'   MSSImplDarwin.__init__   sF    iIC!#&& )r-   c                :   [        SR                  [        5       S   R                  S5      SS 5      5      nU[        :  a   [
        R                  R                  S5      nOSnU(       d  Sn[        U5      e[
        R                  R                  U5      U l        g)zLoad the CoreGraphics library..r   Nr   CoreGraphicszO/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/CoreGraphicszNo CoreGraphics library found.)floatjoinr   splitMAC_VERSION_CATALINActypesutilfind_libraryr   cdllLoadLibraryr\   )r(   versioncoregraphicsrv   s       r+   rt   MSSImplDarwin._init_library   s{    1!3!3C!8!!<=>))!;;33NCL mL2C!#&&KK++L9	r-   c                    U R                   nSU R                  0n[        R                  5        H  u  nu  pEnU" X$   X5U5        M     g)z7Set all ctypes functions and attach them to attributes.r\   N)	_cfactoryr\   rl   items)r(   cfactoryattrsfuncattrargtypesrestypes          r+   ru   MSSImplDarwin._set_cfunctions   sE    >>#/9/?/?/A+D+47U[$': 0Br-   c           	        [         nU R                  n/ n[        5       nUR                  0 5        [	        S5      n[        U R
                  -  " 5       nUR                  U R
                  U[        R                  " U5      5        [        UR                  5       H  nXg   nUR                  U5      n	UR                  U	5      n	U	R                  R                  U	R                  R                  pUR!                  U5      S;   a  XpUR                  U" U	R"                  R$                  5      U" U	R"                  R&                  5      U" U
5      U" U5      S.5        UR)                  XI5      nM     U" UR"                  R$                  5      U" UR"                  R&                  5      U" UR                  R                  5      U" UR                  R                  5      S.US'   U$ )zGet positions of monitors.r   >        V@     V)lefttoprN   rO   )r   r\   rS   appendr   rp   rc   r   byrefrangevaluer^   ri   rV   rN   rO   r_   rU   r?   r@   rj   )r(   int_r\   monitorsall_monitorsdisplay_countactive_displaysidxdisplayrectrN   rO   s               r+   r   MSSImplDarwin.monitors   s   yy
 x !#d&7&77:##D$5$5UbHcd,,-C%*G''0D))$/D IIOOTYY-=-=6
 %%g.-? &vOO /.!%["6l	  ++L?L- .4 ,,../++--.,++112<,,334	
 r-   c                  U R                   n[        US   US   4US   US   45      nUR                  USS[        5      nU(       d  Sn[	        U5      eUR                  U5      nUR                  U5      nSn UR                  U5      n	UR                  U	5      nUR                  U5      n
UR                  U5      n[        R                  " U
[        [        U-  5      5      n[        UR                   5      nUR#                  U5      nUR%                  U5      nUS	-   S
-  nX-  U:w  a>  [        5       n['        U5       H#  nUU-  nUXo-  -   nUR)                  UUU 5        M%     UnU(       a  UR+                  U5        UR+                  U5        U[-        Xg5      4$ ! U(       a  UR+                  U5        UR+                  U5        f = f)z:Retrieve all pixels from a monitor. Pixels have to be RGB.r   r   rN   rO   r   r   z.CoreGraphics.CGWindowListCreateImage() failed.N      )r\   rS   rk   r   r   rh   rg   rf   r]   r`   ra   r   castr   r   	bytearraycontentsre   rd   r   extendrb   r   )r(   monitorr\   r   	image_refrv   rN   rO   	copy_dataprovdata_refbuf_lenrawdatabytes_per_rowbytes_per_pixelcroppedrowstartends                       r+   grabMSSImplDarwin.grab   s   yywv7'':JGT\L]9^_00q!]K	BC!#&&$$Y/&&y1		&..y9D33D9I,,Y7H**95G++h'0A(BCCS\\*D !66yAM"99)DO.2q8O&-7#+ =C-/E%"99CNN4c?3 ) y)NN9%T%(((	 y)NN9%s   :C0F   +Gc                    g)z0Retrieve all cursor data. Pixels have to be RGB.Nr"   rD   s    r+   cursorMSSImplDarwin.cursor  s    r-   )r\   rp   )rr   rH   rp   r   r.   r/   )r.   r/   )r.   r   )r   r   r.   ztuple[bytearray, Size])r0   r1   r2   r3   r4   	__slots__r'   rt   ru   r   r   r   r5   r6   r7   s   @r+   rn   rn   }   sC    
 (I)2  :;1f&)P r-   rn   )r.   ztype[c_double | c_float])0r4   
__future__r   r   ctypes.utilr9   r#   r   r   r   r   r   r	   r
   r   r   r   platformr   typingr   mss.baser   _MSSr   mss.exceptionr   mss.screenshotr   r   
mss.modelsr   r   r   __all__BACKENDSr~   !kCGWindowImageBoundsIgnoreFramingkCGWindowImageNominalResolutionkCGWindowImageShouldBeOpaquer   __annotations__r;   r=   rL   rS   rl   rn   r"   r-   r+   <module>r      s   #   
         & ) 88
"; $* !"( %  79UUXwws w#$ # 8
Di DQY QCY C   &z8<
F3 8*h7(WW-=>
F38*d+%'(2CWXEV'WY`a%z8<$xj(;%z8<(X6
H5 6(F3VV,f5 &8X(NPXY!
J (P% Pr-   