期貨量化軟件:赫茲量化中“動畫框”對象類及其衍生對象
方法邏輯與上面研究過的方法之一雷同。 該方法接收對象 ID、繪制的形狀 X 和 Y 坐標、顏色和不透明度、如若這個 ID 的對象不在列表中,則指示需要創(chuàng)建指定 ID 新對象的標志,以及 圖表重繪標志。 接下來,獲取指向所需對象的指針(如果不存在,則創(chuàng)建該對象)。 如果獲取指針失敗,則返回 false。 如果收到指針,則返回所獲取動畫矩形框?qū)ο蟮?SetPixelOnBG() 方法的結(jié)果。
繪制圖元的其它方法。
其余造型繪制方法的邏輯與上面研究的方法的邏輯雷同。 我們來看看它們的清單:
//+------------------------------------------------------------------+ //| Draw a segment of a vertical line ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| //+------------------------------------------------------------------+ bool CAnimations::DrawLineVerticalOnBG(const int id, ? ? ? ? ? ? ? ? // Frame ID ? ? ? ? ? ? ? ? ? ? ? ? ? const int ? x, ? ? ? ? ? ? ? ? ? ? ? ? ? ?// Segment X coordinate ? ? ? ? ? ? ? ? ? ? ? ? ? const int ? y1, ? ? ? ? ? ? ? ? ? ? ? ? ? // Y coordinate of the segment first point ? ? ? ? ? ? ? ? ? ? ? ? ? const int ? y2, ? ? ? ? ? ? ? ? ? ? ? ? ? // Y coordinate of the segment second point ? ? ? ? ? ? ? ? ? ? ? ? ? const color clr, ? ? ? ? ? ? ? ? ? ? ? ? ?// Color ? ? ? ? ? ? ? ? ? ? ? ? ? const uchar opacity=255, ? ? ? ? ? ? ? ? ?// Opacity ? ? ? ? ? ? ? ? ? ? ? ? ? const bool ?create_new=true, ? ? ? ? ? ? ?// New object creation flag ? ? ? ? ? ? ? ? ? ? ? ? ? const bool ?redraw=false) ? ? ? ? ? ? ? ? // Chart redraw flag ?{ ? CFrameQuad *frame=this.GetOrCreateFrame(DFUN,id,ANIMATION_FRAME_TYPE_QUAD,create_new); ? if(frame==NULL) ? ? ?return false; ? return frame.DrawLineVerticalOnBG(x,y1,y2,clr,opacity,redraw); ?} //+------------------------------------------------------------------+ //| Draw a segment of a horizontal line ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| //+------------------------------------------------------------------+ bool CAnimations::DrawLineHorizontalOnBG(const int id, ? ? ? ? ? ? ? // Frame ID