//================================================================================
// Xe Widget set
//
// Main private header file
//
// AUTHOR:  Gabor Nagy
// DATE:    2026-Mar-31 15:19:05
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//===============================================================================
#ifndef _XeStringP_h
#define _XeStringP_h


//--------------------------------------------------------
// Strings
//--------------------------------------------------------
#define _XeMS_GetComponent(pXeString, pT, pIndex, pN) do\
{\
	(pIndex)++;\
	const uint8_t  lUCh = (pXeString)[pIndex];\
	if(lUCh & 0x80) { (pIndex)++;(pN) = (pXeString)[pIndex] * 256 + (pXeString)[pIndex + 1];(pIndex)++; }\
	else (pN) = lUCh;\
	(pIndex)++;\
	int  lI = 0;for(;lI < (pN);lI++) (pT)[lI] = (pXeString)[pIndex + lI];\
	(pT)[lI] = 0;(pIndex) += (pN);\
} while(0)


#define _XeMS_GetComponentPtr(pXeStr, pC, pN) do\
{\
	(pC)++;\
	const uint8_t  lUCh = (pXeStr)[pC];if(lUCh & 0x80)\
	{\
		(pC)++;\
		(pN) = (pXeStr)[pC] * 256 + (pXeStr)[pC + 1];(pC)++;\
	}\
	else (pN) = lUCh;\
	(pC)++;\
} while(0)


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


extern int  _XeString_NumberOfSegments(XeString LXeStr);

extern void _XeString_DrawSegmentsInLine(XeStringDrawContext* PContext, const XeVisual* PVisual, EpImage* PTargetImage,  const uint16_t PBlendMode, const uint16_t PAlphaOp,  const int PDrawableSizeX, const float PBlurRadius,
 const XeStringBinarySegmentListA* PSegments, const EIndex PLineStart, const EIndex PNSegmentsInLine,  const float PMaxAscent, const int PAlignment, const int PCurrentAlignment,
 const XeCoordinate PX, const XeCoordinate PYI,  const EIndex PLineSizeX, const EIndex PLineSizeY,  const EIndex PFullSizeX,  const EBool PUseColorsInString,  const EBool PResizeCacheImage, const EBool PClearCacheImage);

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
} // Close scope of 'extern "C"' declaration
#endif

#endif // _XeStringP_h
