
    3j#                     2    S r SSKrSSKJr   " S S\5      rg)z~Base class for the various Python data-format storage type APIs

Data-type handlers are specified using OpenGL.plugins module
    N)pluginsc                       \ rS rSrSr0 r0 rSrSrSr	Sr
SrSS/r/ rS r\S	 5       r\S
 5       r\" \5      rSS jrS rSS jrS rSS jrS rSS jrSS jrSS jrSrg)FormatHandler
   zAbstract class describing the handler interface

Each data-type handler is responsible for providing a number of methods
which allow it to manipulate (and create) instances of the data-type
it represents.
N Fnumpyctypesarraysc                 p    [         R                  R                  5        H  nU R                  U5        M     g)z8Load all OpenGL.plugins-registered FormatHandler classesN)r   r   all
loadPlugin)cls
entrypoints     U/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/arrays/formathandler.pyloadAllFormatHandler.loadAll   s'    !//335JNN:& 6    c                    UR                   (       d<  SSKJn   UR                  5       nU" 5       nXBR	                  5       UR
                  '   U$ g! [         aj  nSSKJn  SSK	J
n  UR                  S5      nU(       a  UR                  n	OUR                  n	U	" SUR
                  UR                  U5      5         SnAOSnAff = fSUl         g)	z,Load a single entry-point via plugins moduler   ArrayDatatype)logs)WARN_ON_FORMAT_UNAVAILABLEzOpenGL.formathandlerz5Unable to load registered array format handler %s:
%sNT)loadedOpenGL.arrays.arraydatatyper   loadgetRegistrynameImportErrorOpenGLr   OpenGL._configflagsr   getLogwarninfogetException)
r   r   r   plugin_classhandlererrr   r   _loglogFuncs
             r   r   FormatHandler.loadPlugin!   s       A)0  '.?F))+JOO</ !
  'J{{#9:-"iiG"iiGLOO%%c* & !%Js   A 
CA B>>Cc                 ,   SSK Jn  UR                  5       n X1   $ ! [         am  nUR                  < SUR
                  < 3nU R                  R                  U5      nU(       a  U R                  U5        X1   s SnA$ [        SU< 35      eSnAff = f)zLookup handler by data-typer   r   .Nz'Unable to find data-format handler for )	r   r   r   KeyError
__module____name__LAZY_TYPE_REGISTRYgetr   )r   typer   registryr&   keyplugins          r   
typeLookupFormatHandler.typeLookup>   s     	> ,,.	V>! 	V!__dmm<C++//4Fv&~%dTUU	Vs!    
BAB9B?BBc                 N    SSK Jn  UR                  5       R                  X5        g)z5Register this class as handler for given set of typesr   r   N)r   r   r   register)selftypesr   s      r   r8   FormatHandler.registerP   s    =!!#,,T9r   c                 N    SSK Jn  UR                  5       R                  U 5        g)z8Register this handler as the default return-type handlerr   r   N)r   r   r   registerReturn)r9   r   s     r   r=   FormatHandler.registerReturnV   s    =!!#2248r   c                     g)z!Convert to a ctypes pointer valueNr   r9   valuetypeCodes      r   
from_paramFormatHandler.from_param\       r   c                     g)zreturn long for pointer valueNr   r9   rA   s     r   dataPointerFormatHandler.dataPointer_   rE   r   c                     g)z.Given a value, convert to array representationNr   r@   s      r   asArrayFormatHandler.asArrayb   rE   r   c                     g)z=Given a value, guess OpenGL type of the corresponding pointerNr   rG   s     r   arrayToGLTypeFormatHandler.arrayToGLTypee   rE   r   c                     g)z6Given a data-value, calculate dimensions for the arrayNr   r@   s      r   	arraySizeFormatHandler.arraySizeh   rE   r   c                      U R                   b  gg)z-Determine unit size of an array (if possible)N)baseTyper@   s      r   unitSizeFormatHandler.unitSizek   s    ==$ %r   c                     g)z<Determine dimensions of the passed array value (if possible)Nr   r@   s      r   
dimensionsFormatHandler.dimensionsp   rE   r   )N)r.   r-   __qualname____firstlineno____doc__r/   HANDLER_REGISTRYrT   typeConstantHANDLED_TYPESpreferredOutputisOutputGENERIC_OUTPUT_PREFERENCESALL_OUTPUT_HANDLERSr   classmethodr   r5   r8   r=   rC   rH   rK   rN   rQ   rU   rX   __static_attributes__r   r   r   r   r   
   s     HLMOH")>!:'
 % %8 V V '"G:90,=LE
Kr   r   )r\   ctypesr   r   objectr   r   r   r   <module>rh      s"   
  gKF gKr   