📄 tgraphic.cpp
字号:
aStack.Push((TInt16)20); // y pos
aStack.Push((TInt16)200); // width
aStack.Push((TInt16)200); // height
aStack.Push((TInt16)1); // visible
FuncOpCode::gCreate(aStack,aRuntime,aFramePtr);
id = aStack.PopInt16();
aRuntime.SetIP((TUint8*)pNum);
aStack.Push((TInt16)1);
OpCode::gBorder(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test2(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)30); // x offset
aStack.Push((TInt16)30); // y offset
OpCode::gLineBy(aStack,aRuntime,aFramePtr);
/* aStack.Push((TInt16)30);
aStack.Push((TInt16)-30);
OpCode::gLineBy(aStack,aRuntime,aFramePtr);
aStack.Push((TInt16)30);
aStack.Push((TInt16)30);
OpCode::gLineBy(aStack,aRuntime,aFramePtr);
aStack.Push((TInt16)30);
aStack.Push((TInt16)-30);
OpCode::gLineBy(aStack,aRuntime,aFramePtr); */
}
void CTestGraphics::Test3(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt winId = aStack.PopInt16();
aStack.Push((TInt16)winId);
OpCode::gUse(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test4(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)25); // width of box
aStack.Push((TInt16)35); // height of box
OpCode::gBox(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test5(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
OpCode::gCls(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test6(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)20); // half x-axis length
aStack.Push((TInt16)30); // half y-axis length
OpCode::gEllipse(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test7(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt num = aStack.PopInt16();
TInt* pNum;
pNum = #
aRuntime.SetIP((TUint8*)pNum);
OpCode::gVisible(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test8(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)100); // new x pos
aStack.Push((TInt16)100); // new y pos
aStack.Push((TInt16)150); // new width
aStack.Push((TInt16)100); // new height
TInt num = 4;
TInt* pNum;
pNum = #
aRuntime.SetIP((TUint8*)pNum);
OpCode::gSetWin(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test9(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push(aStack.PopInt16());
OpCode::gClose(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test10(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)50); // bitmap width
aStack.Push((TInt16)40); // bitmap height
FuncOpCode::gCreateBit(aStack,aRuntime,aFramePtr);
TInt id = aStack.PopInt16();
TPtrC filename = _L("c:\\temp\\test.pbm");
aStack.Push(filename);
FuncOpCode::gLoadBit(aStack,aRuntime,aFramePtr);
id = aStack.PopInt16();
}
void CTestGraphics::Test11(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push((TInt16)10); // x pos
aStack.Push((TInt16)10); // y pos
OpCode::gAt(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test12(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
/* COplDrawable* currentDrawable = aRuntime.DrawablesCollection().CurrentDrawable();
RWindowGc& gc = (RWindowGc&)currentDrawable->DrawableGc();
TPoint top = TPoint(40,50);
gc.DrawLine(top,TPoint(top.iX+50,top.iY));
CFbsFont* font = currentDrawable->Font();
TPoint ascent = TPoint(top.iX,top.iY+font->AscentInPixels());
gc.DrawLine(ascent,TPoint(ascent.iX+50,ascent.iY));
TPoint height = TPoint(top.iX,top.iY+font->HeightInPixels());
gc.DrawLine(height,TPoint(height.iX+50,height.iY));
TRect rect = TRect(top,TPoint(top.iX+50,top.iY+font->HeightInPixels()));
gc.DrawText(_L("gPrint"),rect,font->AscentInPixels());
*/
aStack.Push((TInt16)2);
OpCode::gPrintWord(aStack,aRuntime,aFramePtr);
TPtrC text = _L("get World!");
aStack.Push(text);
aStack.Push((TInt16)70);
FuncOpCode::gPrintClip(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test13(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
if (aRuntime.DrawablesCollection().CurrentDrawable()->DrawableFlag() == COplDrawable::EIsOplWindow)
{
FuncOpCode::gOriginX(aStack,aRuntime,aFramePtr);
TInt x = aStack.PopInt16();
FuncOpCode::gOriginY(aStack,aRuntime,aFramePtr);
TInt y = aStack.PopInt16();
FuncOpCode::gWidth(aStack,aRuntime,aFramePtr);
TInt width = aStack.PopInt16();
FuncOpCode::gHeight(aStack,aRuntime,aFramePtr);
TInt height = aStack.PopInt16();
FuncOpCode::gRank(aStack,aRuntime,aFramePtr);
TInt rank = aStack.PopInt16();
TBuf<40> buf;
buf.Format(_L(" x=%d, y=%d, w=%d, h=%d, r=%d \r\n"),x,y,width,height,rank);
aRuntime.Console().Write(buf);
}
}
void CTestGraphics::Test14(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt16 ordPos = aStack.PopInt16();
TInt16 id = aStack.PopInt16();
aStack.Push(id);
aStack.Push(ordPos);
OpCode::gOrder(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test15(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push(aStack.PopInt16());
OpCode::gGMode(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test16(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt mode = aStack.PopInt16();
aStack.Push((TInt16)160); // width
aStack.Push((TInt16)150); // height
aStack.Push((TInt16)mode); // draw mode
OpCode::gFill(aStack,aRuntime,aFramePtr);
/* aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(40,40));
aStack.Push((TInt16)20); // width of rect
aStack.Push((TInt16)15); // height of rect
OpCode::gInvert(aStack,aRuntime,aFramePtr); */
}
void CTestGraphics::Test17(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt16 array[11];
array[0] = 20; array[1] = 80; // startting x and y pos
array[2] = 4; // five operations
array[3] = 40*2; array[4] = -40;
array[5] = 40*2; array[6] = 40;
array[7] = -40*2; array[8] = 40;
array[9] = -40*2; array[10] = -40;
TInt16* arrayPtr;
arrayPtr = &array[0];
aStack.PushRef(*arrayPtr);
OpCode::gPoly(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test18(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
/* TInt num = 1;
TInt* pNum;
pNum = #
aRuntime.SetIP((TUint8*)pNum);
TPtrC filename = _L("c:\\temp\\test.pbm");
aStack.Push(filename);
OpCode::gSaveBit(aStack,aRuntime,aFramePtr); */
aStack.Push((TInt16)55); // bold, italic
OpCode::gStyle(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test19(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
aStack.Push(aStack.PopInt16()); // text mode
OpCode::gTMode(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test20(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt num = 2;
TInt* pNum;
pNum = #
aRuntime.SetIP((TUint8*)pNum);
TPtrC text = _L("(gPrintb)");
aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(25,30));
aStack.Push(text);
aStack.Push((TInt16)100); // box width = 100
OpCode::gPrintBoxText(aStack,aRuntime,aFramePtr);
num = 3;
aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(25,60));
aRuntime.SetIP((TUint8*)pNum);
aStack.Push(text);
aStack.Push((TInt16)100); // box width = 100
aStack.Push((TInt16)3); // alignment is center
OpCode::gPrintBoxText(aStack,aRuntime,aFramePtr);
num = 4;
aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(25,90));
aRuntime.SetIP((TUint8*)pNum);
aStack.Push(text);
aStack.Push((TInt16)100); // box width = 100
aStack.Push((TInt16)-1); // alignment is right
aStack.Push((TInt16)2); // top clearance = 2
OpCode::gPrintBoxText(aStack,aRuntime,aFramePtr);
num = 5;
aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(25,120));
aRuntime.SetIP((TUint8*)pNum);
aStack.Push(text);
aStack.Push((TInt16)100); // box width = 100
aStack.Push((TInt16)2); // alignment is left
aStack.Push((TInt16)2); // top clearance = 2
aStack.Push((TInt16)3); // bottom clearance = 3
OpCode::gPrintBoxText(aStack,aRuntime,aFramePtr);
num = 6;
aRuntime.DrawablesCollection().CurrentDrawable()->SetCursorPosition(TPoint(25,150));
aRuntime.SetIP((TUint8*)pNum);
aStack.Push(text);
aStack.Push((TInt16)100); // box width = 100
aStack.Push((TInt16)3); // alignment is center
aStack.Push((TInt16)0); // top clearance = 0
aStack.Push((TInt16)0); // bottom clearance = 0
aStack.Push((TInt16)7); // margin = 7
OpCode::gPrintBoxText(aStack,aRuntime,aFramePtr);
}
void CTestGraphics::Test21(CStack& aStack, COplRuntime& aRuntime, CFrame* aFramePtr)
{
TInt num = 2;
TInt* pNum;
pNum = #
aRuntime.SetIP((TUint8*)pNum);
aStack.Push((TInt16)10); // x offset
aStack.Push((TInt16)10); // y offset
OpCode::gScroll(aStack,aRuntime,aFramePtr); // doesn't work due to bug in wserv!
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -