MCPcopy Create free account
hub / github.com/axmolengine/axmol / getPixelOriginOffset

Method getPixelOriginOffset

core/base/NinePatchImageParser.cpp:68–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int NinePatchImageParser::getPixelOriginOffset(Direction direction) const
69{
70 int imageWidth = _image->getWidth();
71 int frameWidth = this->getFrameWidth();
72
73 int topLineLeftOffset = (int)_imageFrame.origin.y * imageWidth * 4 + (int)_imageFrame.origin.x * 4;
74 if (direction == Direction::HORIZONTAL)
75 {
76 return topLineLeftOffset;
77 }
78 else
79 {
80 if (_isRotated)
81 {
82 return topLineLeftOffset + (frameWidth - 1) * 4;
83 }
84 else
85 {
86 return topLineLeftOffset;
87 }
88 }
89}
90
91Vec2 NinePatchImageParser::parseHorizontalMargin() const
92{

Callers 2

parseHorizontalMarginMethod · 0.95
parseVerticalMarginMethod · 0.95

Calls 2

getFrameWidthMethod · 0.95
getWidthMethod · 0.45

Tested by

no test coverage detected