64constexpr tInt g_nGCL_ItemSize =
sizeof(tUInt32);
65constexpr tInt g_nGCL_CommandSize = g_nGCL_ItemSize;
66constexpr tInt g_nGCL_ParamSize = g_nGCL_ItemSize;
67constexpr tInt g_nGCL_ExtraSize = g_nGCL_ItemSize;
69#define GCL_SIZE(nParams, nExtra) (1 + (nParams) + (nExtra))
70#define GCL_SIZE_DYNAMIC() (0)
76 {GCL_CMD_FLOAT, GCL_SIZE(0, 0),
"float"},
77 {GCL_CMD_CLEAR, GCL_SIZE(0, 0),
"clear"},
78 {GCL_CMD_FGCOL, GCL_SIZE(1, 0),
"fgcol"},
101class cGCLProcessor :
public ucom::catwo::object<ucom::IEventSource, ucom::cEventSource>
194 tVoid* pCommandBlock,
199 tBool bFlipRGB = tFalse)
201 RETURN_IF_POINTER_NULL(pCanvas);
202 RETURN_IF_POINTER_NULL(pCommandBlock);
206 return ProcessBlock(pCommandBlock, nBlockSize, nOrigWidth, nOrigHeight, sTargetRect);
223 tVoid* pCommandBlock,
228 tBool bFlipRGB = tFalse)
230 RETURN_IF_POINTER_NULL(hCanvas);
231 RETURN_IF_POINTER_NULL(pCommandBlock);
237 static HPEN hPen = NULL;
243 hPen = CreatePen(PS_SOLID, 0, RGB(255, 0, 0));
246 HPEN hOldPen =
nullptr;
249 hOldPen = (HPEN) SelectObject((HDC)
m_hCanvas, hPen);
253 tResult nResult =
ProcessBlock(pCommandBlock, nBlockSize, nOrigWidth, nOrigHeight, sTargetRect);
275 RETURN_IF_POINTER_NULL(pSmallFont);
276 RETURN_IF_POINTER_NULL(pNormalFont);
277 RETURN_IF_POINTER_NULL(pHugeFont);
297 tResult
ProcessBlock(tVoid* pCommandBlock, tInt nBlockSize, tUInt nOrigWidth, tUInt nOrigHeight,
cRect sTargetRect)
299 RETURN_IF_POINTER_NULL(pCommandBlock);
302 tUInt32* pData = (tUInt32*) pCommandBlock;
303 tUInt32* pEndOfData = pData + (nBlockSize / detail::g_nGCL_ItemSize - 1);
306 tUInt32 nMaxIdentifier =
sizeof(detail::g_aGCLCommandTable) /
sizeof(detail::g_aGCLCommandTable[0]);
308 CalcScale(nOrigWidth, nOrigHeight, sTargetRect);
312 while (pData < pEndOfData)
314 nIdentifier = *pData;
319 else if (nIdentifier >= nMaxIdentifier)
321 RETURN_ERROR(ERR_INVALID_ARG);
327 RETURN_IF_FAILED(
ProcessCommand(pCmd, pData + 1, nJump, sTargetRect));
332 CalcScale(nOrigWidth, nOrigHeight, sTargetRect);
337 pData += pCmd->
nSize;
365 tFloat32* pFloatParam = (tFloat32*) pParam;
366 tInt32* pCoordParam = (tInt32*) pParam;
421 pCanvas->
Color(((tUInt8*) (pParam))[2], ((tUInt8*) (pParam))[1], ((tUInt8*) (pParam))[0],
422 ((tUInt8*) (pParam))[3]);
426 pCanvas->
Color(((tUInt8*) (pParam))[0], ((tUInt8*) (pParam))[1], ((tUInt8*) (pParam))[2],
427 ((tUInt8*) (pParam))[3]);
436 pCanvas->
BgColor(((tUInt8*) (pParam))[2], ((tUInt8*) (pParam))[1], ((tUInt8*) (pParam))[0],
437 ((tUInt8*) (pParam))[3]);
441 pCanvas->
BgColor(((tUInt8*) (pParam))[0], ((tUInt8*) (pParam))[1], ((tUInt8*) (pParam))[2],
442 ((tUInt8*) (pParam))[3]);
468 tInt nParamX = 0, nParamY = 0;
469 GetCoords(pParam, sTargetRect, nParamX, nParamY);
487 tInt nParamX = 0, nParamY = 0;
488 GetCoords(pParam, sTargetRect, nParamX, nParamY);
496 tInt nParamX = 0, nParamY = 0;
497 GetCoords(pParam, sTargetRect, nParamX, nParamY);
505 tInt nParamX = 0, nParamY = 0;
506 GetCoords(pParam, sTargetRect, nParamX, nParamY);
516 tUInt32 nTextLength = pParam[2];
518 nJump = 4 + (nTextLength + detail::g_nGCL_ItemSize - 1) / detail::g_nGCL_ItemSize;
519 tChar* strText = (tChar*) (pParam + 3);
521 tChar* pBuffer =
new tChar[nTextLength + 1];
524 RETURN_ERROR(ERR_MEMORY);
527 adtf_util::cMemoryBlock::MemCopy(pBuffer, strText, nTextLength);
528 *(pBuffer + nTextLength) =
'\0';
538 tUInt32 nLineWidth = pParam[0];
545 tUInt16 nLinePattern = (tUInt16) pParam[0];
546 tInt nFactor = pParam[1];
560 nRadiusY = nRadiusX = (tInt) ((pFloatParam[2] *
m_fScaleX) + 0.5);
564 nRadiusY = nRadiusX = (tInt) ((pCoordParam[2] *
m_fScaleX) + 0.5);
582 nRadiusY = nRadiusX = (tInt) ((pFloatParam[2] *
m_fScaleX) + 0.5);
586 nRadiusY = nRadiusX = (tInt) ((pCoordParam[2] *
m_fScaleX) + 0.5);
596 tInt nParamCount = *pParam++;
597 if (nParamCount == 0 || ((nParamCount & 1) == 1))
599 RETURN_ERROR(ERR_INVALID_ARG);
608 for (tInt i = 1; i < nParamCount; i++)
610 tInt nParamX = 0, nParamY = 0;
611 GetCoords(pParam, sTargetRect, nParamX, nParamY);
619 nJump += nParamCount * 2 + 2;
625 tInt nParamCount = *pParam++;
626 if (nParamCount == 0 || ((nParamCount & 1) == 1))
628 RETURN_ERROR(ERR_INVALID_ARG);
632 std::vector<IPoint*> vPoints;
634 for (tInt i = 0; i < nParamCount; i++)
641 pCanvas->
FillPolygon(&vPoints.at(0),
static_cast<tInt
>(vPoints.size()));
643 for (tUInt i = 0; i < vPoints.size(); i++)
645 vPoints[i]->Release();
647 nJump += nParamCount * 2 + 2;
680 if (nOrigWidth != 0 && nOrigHeight != 0)
708 tResult
GetCoords(
const tUInt32* pParam,
const cRect& sTargetRect, tInt& x, tInt& y)
const
712 tFloat32* pFloatParam = (tFloat32*) pParam;
718 tInt32* pCoordParam = (tInt32*) pParam;
728using dengar::IGCLProcessorEvents;
729using dengar::cGCLProcessor;
cGCLProcessor()
Constructor.
virtual tVoid Clear()=0
Clears the canvas and all drawings to background color.
virtual tVoid FillCircle(tInt x1, tInt y1, tInt x2, tInt y2)=0
Fills a circle with the current color.
virtual tVoid DrawCircle(tInt x1, tInt y1, tInt x2, tInt y2)=0
Draws a circle.
virtual tVoid DrawPixel(tInt x, tInt y)=0
Draws a pixel at the given position.
virtual tVoid Font(IFont *pFont)=0
Sets the current font for drawing operations.
virtual tVoid OutputText(tInt x, tInt y, const tChar *fmt,...)=0
Sets an text to a given position.
virtual tVoid DrawRect(tInt x1, tInt y1, tInt x2, tInt y2)=0
Draws a rectangle using two given corners.
virtual tVoid FillPolygon(IPoint **ppPoints, tInt nCount)=0
Fills a polygon by the given point array.
virtual tVoid FillRect(tInt x1, tInt y1, tInt x2, tInt y2)=0
Fills a rectangle with the current color.
virtual tVoid DrawLine(tInt x1, tInt y1, tInt x2, tInt y2)=0
Draws a line between two given points.
Default Font handling interface for basic font support.
Class for events of Graphics Command Language.
tGCLProcessorEventIds
Event Id enumeration for the tGCLProcessEvent::nEventId.
@ GCLPE_Clear
emited when a clear command was processed.
virtual tVoid BgColor(const IColor *col)=0
This function sets the current background color to col value.
virtual tVoid EnableAlpha(tBool bAdditiveMode=tFalse) const =0
This function enables the alpha graphics mode.
virtual tVoid DisableAlpha() const =0
This function disables the alpha graphics mode.
virtual tVoid Color(const IColor *col)=0
This function sets the current color to col value.
virtual tVoid LinePattern(tUInt16 ui16Pattern, tInt nFactor=1)=0
This function adjusts the Line Style for all Lines in drawing operations.
virtual tVoid LineWidth(tFloat64 fWidth)=0
This function sets the current line width to the fWidth value.
tResult SetFonts(IFont *pSmallFont, IFont *pNormalFont, IFont *pHugeFont)
Sets small, normal and huge font for the GCL_CMD_Text Command.
tResult CalcScale(tUInt nOrigWidth, tUInt nOrigHeight, const cRect &sTargetRect)
Calculate the current scaling factor and sets the members m_fScaleX and m_fScaleY.
tBool m_bFormatFloat
Use integer (false) or floating-point (true) coordinates.
cGCLProcessor()
Constructor.
tResult Create()
Create GCLProcessor.
tResult ProcessBlock(tVoid *pCommandBlock, tInt nBlockSize, tUInt nOrigWidth, tUInt nOrigHeight, cRect sTargetRect)
Process command block.
tResult Process(tHandle hCanvas, tVoid *pCommandBlock, tInt nBlockSize, tUInt nOrigWidth, tUInt nOrigHeight, cRect sTargetRect, tBool bFlipRGB=tFalse)
Process command block on canvas.
tResult Process(ICanvas *pCanvas, tVoid *pCommandBlock, tInt nBlockSize, tUInt nOrigWidth, tUInt nOrigHeight, cRect sTargetRect, tBool bFlipRGB=tFalse)
Process command block on canvas.
tBool m_bInitialized
Is GCLProcessor initialized?
tFloat32 m_fScaleX
Current scaling factor.
tInt m_nCurrentX
Current x coordinate (integer)
IFont * m_pSmallFont
Small font for GCL_CMD_Text Command.
tResult ProcessCommand(const tGCLCommandDescriptor *pCmd, tUInt32 *pParam, tInt &nJump, cRect sTargetRect)
Process command.
tFloat32 m_fScaleY
Current scaling factor.
tResult GetCoords(const tUInt32 *pParam, const cRect &sTargetRect, tInt &x, tInt &y) const
Takes the first two parameters from the array (pParam) converts them depending on the m_bFormatFloat ...
tInt m_nCurrentY
Current y coordinate (integer)
tResult Release()
Release GCLProcessor.
tHandle m_hCanvas
Windows canvas handle for output.
IFont * m_pHugeFont
Huge font for GCL_CMD_Text Command.
virtual ~cGCLProcessor()
Destructor.
tBool m_bFlipRGB
Flag for legacy issues.
IFont * m_pNormalFont
Normal font for GCL_CMD_Text Command.
ICanvas * m_pCanvas
D-Pointer implementation.
tInt m_nRight
right border of the rect
tInt m_nTop
top border of the rect
tInt m_nLeft
left border of the rect
tInt m_nBottom
bottom border of the rect
Copyright © Audi Electronics Venture GmbH.
@ GCL_CMD_LINEWIDTH
Sets width for line drawing operations.
@ GCL_CMD_DRAWCIRCLE
Draws a circle at the specified point and with the given diameter.
@ GCL_CMD_TEXT_SIZE_HUGE
Sets current font to huge font.
@ GCL_CMD_FLOAT
Switches mode to float coordinates (not supported)
@ GCL_CMD_TEXT_SIZE_SMALL
Sets current font to small font.
@ GCL_CMD_DRAWLINE
Draws a line between the specified points.
@ GCL_CMD_FILLPOLYGON
Fills a polygon.
@ GCL_CMD_ALPHA
Enable/Disable alpha blending (OpenGL only)
@ GCL_CMD_TEXT_SIZE_NORMAL
Sets current font to normal font.
@ GCL_CMD_INT
Switches mode to integer coordinates (not supported)
@ GCL_CMD_LINEPATTERN
Sets the line pattern (pattern, factor)
@ GCL_CMD_DRAWPIXEL
Draws a pixel at the specified coordinate.
@ GCL_CMD_BGCOL
Sets background color.
@ GCL_CMD_LINETO
Draws a line from the current position to the specified coordinate.
@ GCL_CMD_FGCOL
Sets foreground color.
@ GCL_CMD_FILLCIRCLE
Draws a filled circle at the specified point with the given diameter.
@ GCL_CMD_END
Marks the end of the GCL buffer.
@ GCL_CMD_DRAWPOLYGON
Draws a polygon (outline)
@ GCL_CMD_CLEAR
Clears the drawing canvas.
@ GCL_CMD_FILLRECT
Draws a filled rectangle.
@ GCL_CMD_MOVETO
Moves the drawing cursor to the specified coordinate.
@ GCL_CMD_DRAWRECT
Draws a rectangle.
@ GCL_CMD_TEXT
Generates text output at specified coordinate.
Copyright © Audi Electronics Venture GmbH.
Namespace for functionality provided by the Display Toolbox.
Copyright © Audi Electronics Venture GmbH.
Event structure for signal registry events through the ucom::IEventSource interface.
tUInt32 nEventId
EventId shown in IGCLProcessorEvents::tGCLProcessorEventIds.
tInt32 i32Param2
A event content specific parameter.
tVoid * pvData
Pointer to additional event data.
tSize szDataLength
size of the additional event data.
tInt32 i32Param1
A event content specific parameter.
tInt nSize
Size of arguments.
tInt nId
ID value from tGCLCommandIdentifier enumeration.