📄 sitetran.cpp
字号:
}
void tranLines::Offset(int x, int y)
{
for (int i = 0; i < m_nLines; ++i)
{
m_pLines[i].start.x += x;
m_pLines[i].start.y += y;
m_pLines[i].finish.x += x;
m_pLines[i].finish.y += y;
}
}
void tranLines::Destroy()
{
if (m_pLines)
{
delete [] m_pLines;
m_pLines = NULL;
}
m_nLines = 0;
}
void tranLines::Clip(int left, int top, int right, int bottom)
{
int newlines = m_nLines;
for (int i = 0; i < m_nLines; ++i)
{
if (!m_pLines[i].Clip(left, top, right, bottom))
{
// the line is not within our area so mark it for clipping
m_pLines[i].start.x = m_pLines[i].start.y = m_pLines[i].finish.x = m_pLines[i].finish.y = -42;
--newlines;
}
}
if (newlines != m_nLines) // do we need to remove any lines?
{
tranLines tmpLines;
tmpLines.m_nLines = newlines;
tmpLines.m_pLines = new LineSegment[newlines];
for (int i = 0, c = 0; c < newlines; ++i)
{
if (m_pLines[i].start.x != -42 && m_pLines[i].start.y != -42 &&
m_pLines[i].finish.x != -42 && m_pLines[i].finish.y != -42)
{
tmpLines.m_pLines[c++] = m_pLines[i];
}
}
}
}
void GetDiagonalStripCoords(HXxPoint topLeft, HXxPoint topRight, HXxPoint bottomRight, HXxPoint bottomLeft, HXxPoint* topPoint, HXxPoint* bottomPoint, int completeness)
{
int topWidth = topRight.x - topLeft.x;
int bottomWidth = bottomRight.x - bottomLeft.x;
int height = max(bottomLeft.y - topLeft.y, bottomRight.y - topRight.y);
double angle;
int length;
int mark;
if (topWidth > bottomWidth)
{
int rightHeight = topLeft.y - topRight.y;
length = int(sqrt((double)(topWidth * topWidth + rightHeight * rightHeight)));
mark = int(double(length * completeness) / 1000.0);
angle = atan(double(topLeft.y - topRight.y) / double(topWidth));
topPoint->x = int(topLeft.x + cos(angle) * mark);
topPoint->y = int(topLeft.y - sin(angle) * mark);
int length2 = int(sin(angle) * height);
bottomPoint->x = topPoint->x + int(cos(angle) * length2 + 1);
bottomPoint->y = topPoint->y + height - int(sin(angle) * length2);
}
else
{
int leftHeight = bottomLeft.y - bottomRight.y;
length = int(sqrt((double)(bottomWidth * bottomWidth + leftHeight * leftHeight)));
mark = int(double(length * completeness) / 1000.0);
angle = atan(double(bottomLeft.y - bottomRight.y) / double(bottomWidth));
bottomPoint->x = int(bottomLeft.x + cos(angle) * mark + 1);
bottomPoint->y = int(bottomLeft.y - sin(angle) * mark);
int length2 = int(sin(angle) * height);
topPoint->x = bottomPoint->x - int(cos(angle) * length2 + 1);
topPoint->y = bottomPoint->y - height + int(sin(angle) * length2);
}
}
void PrintRgnData(HXREGION* retRGN)
{
#ifdef _WINDOWS
FILE* f1 = ::fopen("d:\\expose.txt", "a+"); /* Flawfinder: ignore */
LPRGNDATA lpRgnData;
DWORD sizeNeeed = GetRegionData((HRGN)retRGN, 0, NULL);
lpRgnData = (LPRGNDATA) new char[sizeNeeed];
GetRegionData((HRGN)retRGN, sizeNeeed, lpRgnData);
for(int j = 0; j < (int) lpRgnData->rdh.nCount;j++)
{
HXRECTANGLE* pRect = (HXRECTANGLE*) lpRgnData->Buffer;
::fprintf(f1, "Rect (%d, %d) -(%d, %d)\n", pRect[j].x, pRect[j].y, pRect[j].width, pRect[j].height);
}
delete lpRgnData;
fclose(f1);
#else
HX_ASSERT(!"cant print rgn data");
#endif
}
//#define _TESTING_TRANITIONS_
/*
* Table of all transition effects
*/
// {DefaultTransition, ""},
#ifdef _TRANSITIONS_ON_
tranStruct z_barWipeTable[] =
{
{EdgeWipe, 1,"leftToRight"},
{SlideVerticalEdgeWipe, 2, "topToBottom"}
};
tranStruct z_boxWipeTable[] =
{
{TopLeftEdgeWipe, 3, "topLeft"},
{TopRightEdgeWipe, 4, "topRight"},
{BottomRightEdgeWipe, 5, "bottomRight"},
{BottomLeftEdgeWipe, 6, "bottomLeft"},
{TopCenterEdgeWipe, 23, "topCenter"},
{CenterRightEdgeWipe, 24, "rightCenter"},
{BottomCenterEdgeWipe, 25, "bottomCenter"},
{LeftCenterEdgeWipe, 26, "leftCenter"}
};
tranStruct z_fourBoxTable[] =
{
{FourCornerEdgeWipe, 7, "cornersIn"},
{FourBoxEdgeWipe , 8, "cornersOut"}
};
tranStruct z_barnDoorTable[] =
{
{BarnVerticalEdgeWipe , 21, "vertical"},
{BarnHorizontalEdgeWipe, 22, "horizontal"},
{DiagonaLeftOutEdgeWipe, 45, "diagonalBottomLeft"},
{DiagonaRightOutEdgeWipe, 46, "diagonalTopLeft"}
};
tranStruct z_diagonalTable[] =
{
{DiagonalLeftDownEdgeWipe, 41, "topLeft"},
{DiagonalRightDownEdgeWipe, 42, "topRight"}
};
tranStruct z_bowTieTable[] =
{
{VerticalBowTieEdgeWipe, 43, "vertical"},
{HorizontalBowTieEdgeWipe, 44, "horizontal"}
};
tranStruct z_miscDiagonalTable[] =
{
{DiagonaCrossEdgeWipe, 47, "doubleBarnDoor"},
{DiagonalBoxEdgeWipe, 48, "doubleDiamond"}
};
tranStruct z_veeTable[] =
{
{FilledVEdgeWipe, 61, "down"},
{FilledVRightEdgeWipe, 62, "left"},
{FilledVBottomEdgeWipe, 63, "up"},
{FilledVLeftEdgeWipe, 64, "right"}
};
tranStruct z_barnVeeTable[] =
{
{HollowVEdgeWipe, 65, "down"},
{HollowVRightEdgeWipe, 66, "left"},
{HollowVBottomEdgeWipe , 67, "up"},
{HollowVLeftEdgeWipe, 68, "right"}
};
tranStruct z_zigZagTable[] =
{
{VerticalZigZagEdgeWipe, 71, "leftToRight"},
{HorizontalZigZagEdgeWipe, 72, "topToBottom"}
};
tranStruct z_barnZigZagTable[] =
{
{VerticalBarnZigZagEdgeWipe, 73, "vertical"},
{HorizontalBarnZigZagEdgeWipe, 74, "horizontal"}
};
//-----------------------------------------------------------------------
tranStruct z_irisTable[] =
{
{RectangleIris, 101, "rectangle"},
{DiamondIris, 102, "diamond"}
};
tranStruct z_triangleTable[] =
{
{TriangleIris, 103, "up"},
{TriangleRightIris, 104, "right"},
{TriangleUpsideDownIris, 105, "down"},
{TriangleLeftIris, 106, "left"}
};
tranStruct z_arrowHeadTable[] =
{
{ArrowHeadIris, 107, "up"},
{ArrowHeadRightIris, 108, "right"},
{ArrowHeadUpsideDownIris, 109, "down"},
{ArrowHeadLeftIris, 110, "left"}
};
tranStruct z_pentagonTable[] =
{
{PentagonIris, 111, "up"},
{PentagonUpsideDownLeftIris, 112, "down"}
};
tranStruct z_hexagonTable[] =
{
{HexagonSideIris, 113, "horizontal"},
{HexagonIris, 114, "vertical"}
};
tranStruct z_ellipseTable[] =
{
{CircleIris, 119, "circle"},
{OvalIris, 120, "horizontal"},
{OvalSideIris, 121, "vertical"}
};
tranStruct z_eyeTable[] =
{
{CatEyeIris, 122, "horizontal"},
{CatEyeSideIris, 123, "vertical"}
};
tranStruct z_roundRectTable[] =
{
{RoundRectHorizontal, 124, "horizontal"},
{RoundRectVeritical, 125, "vertical"}
};
tranStruct z_starTable[] =
{
{FourPointStarIris, 127, "fourPoint"},
{FivePointStarIris, 128, "fivePoint"},
{SixPointStarIris, 129, "sixPoint"}
};
tranStruct z_miscShapeTable[] =
{
{HeartIris, 130, "heart"},
{KeyHoleIris, 131, "keyhole"}
};
//-----------------------------------------------------------------------
tranStruct z_clockTable[] =
{
{RotatingTopRadial, 201, "clockwiseTwelve"},
{RotatingRightRadial, 202, "clockwiseThree"},
{RotatingBottomRadial , 203, "clockwiseSix"},
{RotatingLeftRadial, 204, "clockwiseNine"}
};
tranStruct z_pinWheelTable[] =
{
{RotatingTopBottomRadial, 205, "twoBladeVertical"},
{RotatingLeftRightRadial, 206, "twoBladeHorizontal"},
{RotatingQuadrantRadial, 207, "fourBlade"}
};
tranStruct z_singleSweepTable[] =
{
{Top180Radial, 221, "clockwiseTop"},
{Right180Radial, 222, "clockwiseRight"},
{Bottom180Radial, 223, "clockwiseBottom"},
{Left180Radial, 224, "clockwiseLeft"},
{RotatingTopLeftRadial, 241, "clockwiseTopLeft"},
{RotatingBottomLeftRadial, 242, "counterClockwiseBottomLeft"},
{RotatingBottomRightRadial, 243, "clockwiseBottomRight"},
{RotatingTopRightRadial, 244, "counterClockwiseTopRight"}
};
tranStruct z_fanTable[] =
{
{TopBottom180Radial, 211, "centerTop"},
{RightToLeft180Radial, 212, "centerRight"},
{OpenVTopRadial, 231, "top"},
{OpenVRightRadial, 232, "right"},
{OpenVBottomRadial, 233, "bottom"},
{OpenVLeftRadial, 234, "left"},
};
tranStruct z_doubleFanTable[] =
{
{topBottom90Radial, 213, "fanOutVertical"},
{RightToLeft90Radial, 214, "fanOutHorizontal"},
{OpenVTopBottomRadial, 235, "fanInVertical"},
{OpenVLeftRightRadial, 236, "fanInHorizontal"}
};
tranStruct z_doubleSweepTable[] =
{
{CounterRotatingTopBottomRadial, 225, "parallelVertical"},
{CounterRotatingLeftRightRadial, 226, "parallelDiagonal"},
{DoubleRotatingTopBottomRadial, 227, "oppositeVertical"},
{DoubleRotatingLeftRightRadial, 228, "oppositeHorizontal"},
{RotatingTopLeftBottomRightRadial, 245, "parallelDiagonalTopLeft"},
{RotatingBottomLeftTopRightRadial, 246, "parallelDiagonalBottomLeft"}
};
tranStruct z_saloonDoorTable[] =
{
{RotatingTopLeftRightRadial, 251, "top"},
{RotatingLeftTopBottomRadial, 252, "left"},
{RotatingBottomLeftRightRadial, 253, "bottom"},
{RotatingRightTopBottomRadial, 254, "right"}
};
tranStruct z_windshieldTable[] =
{
{RotatingDoubleCenterRightRadial, 261, "right"},
{RotatingDoubleCenterTopRadial, 262, "up"},
{RotatingDoubleCenterTopBottomRadial, 263, "vertical"},
{RotatingDoubleCenterLeftRightRadial, 264, "horizontal"}
};
//-----------------------------------------------------------------------
tranStruct z_snakeTable[] =
{
{HorizontalMatrix, 301, "topLeftHorizontal"},
{VerticalMatrix, 302, "topLeftVertical"},
{TopLeftDiagonalMatrix, 303, "topLeftDiagonal"},
{TopRightDiagonalMatrix, 304, "topRightDiagonal"},
{BottomRightDiagonalMatrix, 305, "bottomRightDiagonal"},
{BottomLeftDiagonalMatrix, 306, "bottomLeftDiagonal"}
};
tranStruct z_spiralTable[] =
{
{ClockwiseTopLeftMatrix, 310, "topLeftClockwise"},
{ClockwiseTopRightMatrix, 311, "topRightClockwise"},
{ClockwiseBottomRightMatrix, 312, "bottomRightClockwise"},
{ClockwiseBottomLeftMatrix, 313, "bottomLeftClockwise"},
{CounterClockwiseTopLeftMatrix, 314, "topLeftCounterClockwise"},
{CounterClockwiseTopRightMatrix, 315, "topRightCounterClockwise"},
{CounterClockwiseBottomRightMatrix, 316, "bottomRightCounterClockwise"},
{CounterClockwiseBottomLeftMatrix, 317, "bottomLeftCounterClockwise"}
};
tranStruct z_parallelSnakesTable[] =
{
{VerticalStartTopMatrix, 320, "verticalTopSame"},
{VerticalStartBottomMatrix, 321, "verticalBottomSame"},
{VerticalStartTopOppositeMatrix, 322, "verticalTopLeftOpposite"},
{VerticalStartBottomOppositeMatrix, 323, "verticalBottomLeftOpposite"},
{HorizontalStartLeftMatrix, 324, "horizontalLeftSame"},
{HorizontalStartRightMatrix, 325, "horizontalRightSame"},
{HorizontalStartLeftOppositeMatrix, 326, "horizontalTopLeftOpposite"},
{HorizontalStartRightOppositeMatrix, 327, "horizontalTopRightOpposite"},
{DoubleDiagonalBottom, 328, "diagonalBottomLeftOpposite"},
{DoubleDiagonalTop, 329, "diagonalTopLeftOpposite"}
};
tranStruct z_boxSnakesTable[] =
{
{DoubleSpiralTopMatrix, 340, "twoBoxTop"},
{DoubleSpiralBottomMatrix, 341, "twoBoxBottom"},
{DoubleSpiralLeftMatrix, 342, "twoBoxLeft"},
{DoubleSpiralRightMatrix, 343, "twoBoxRight"},
{QuadSpiralVerticalMatrix, 344, "fourBoxVertical"},
{QuadSpiralHorizontalMatrix, 345, "fourBoxHorizontal"}
};
tranStruct z_waterfallTable[] =
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -