Lines Matching refs:image
887 static void getOutline(PngInfo* image) { in getOutline() argument
888 int midX = image->width / 2; in getOutline()
889 int midY = image->height / 2; in getOutline()
890 int endX = image->width - 2; in getOutline()
891 int endY = image->height - 2; in getOutline()
894 if (image->width > 4) { in getOutline()
895 findMaxOpacity(image->rows.data(), 1, midY, midX, -1, 1, 0, in getOutline()
896 &image->outlineInsetsLeft); in getOutline()
897 findMaxOpacity(image->rows.data(), endX, midY, midX, -1, -1, 0, in getOutline()
898 &image->outlineInsetsRight); in getOutline()
900 image->outlineInsetsLeft = 0; in getOutline()
901 image->outlineInsetsRight = 0; in getOutline()
905 if (image->height > 4) { in getOutline()
906 findMaxOpacity(image->rows.data(), midX, 1, -1, midY, 0, 1, in getOutline()
907 &image->outlineInsetsTop); in getOutline()
908 findMaxOpacity(image->rows.data(), midX, endY, -1, midY, 0, -1, in getOutline()
909 &image->outlineInsetsBottom); in getOutline()
911 image->outlineInsetsTop = 0; in getOutline()
912 image->outlineInsetsBottom = 0; in getOutline()
915 int innerStartX = 1 + image->outlineInsetsLeft; in getOutline()
916 int innerStartY = 1 + image->outlineInsetsTop; in getOutline()
917 int innerEndX = endX - image->outlineInsetsRight; in getOutline()
918 int innerEndY = endY - image->outlineInsetsBottom; in getOutline()
924 image->outlineAlpha = std::max( in getOutline()
925 maxAlphaOverRow(image->rows[innerMidY], innerStartX, innerEndX), in getOutline()
926 maxAlphaOverCol(image->rows.data(), innerMidX, innerStartY, innerStartY)); in getOutline()
929 findMaxOpacity(image->rows.data(), innerStartX, innerStartY, innerMidX, in getOutline()
938 image->outlineRadius = 3.4142f * diagonalInset; in getOutline()
942 image->outlineInsetsLeft, image->outlineInsetsTop, in getOutline()
943 image->outlineInsetsRight, image->outlineInsetsBottom, in getOutline()
944 image->outlineRadius, image->outlineAlpha); in getOutline()
977 static bool do9Patch(PngInfo* image, std::string* outError) { in do9Patch() argument
978 image->is9Patch = true; in do9Patch()
980 int W = image->width; in do9Patch()
981 int H = image->height; in do9Patch()
986 int32_t* xDivs = image->xDivs = new int32_t[W]; in do9Patch()
987 int32_t* yDivs = image->yDivs = new int32_t[H]; in do9Patch()
1000 image->info9Patch.paddingLeft = image->info9Patch.paddingRight = -1; in do9Patch()
1001 image->info9Patch.paddingTop = image->info9Patch.paddingBottom = -1; in do9Patch()
1002 image->layoutBoundsLeft = image->layoutBoundsRight = 0; in do9Patch()
1003 image->layoutBoundsTop = image->layoutBoundsBottom = 0; in do9Patch()
1005 png_bytep p = image->rows[0]; in do9Patch()
1038 if (!getVerticalTicks(image->rows.data(), 0, H, transparent, true, &yDivs[0], in do9Patch()
1046 image->info9Patch.numXDivs = numXDivs; in do9Patch()
1047 image->info9Patch.numYDivs = numYDivs; in do9Patch()
1050 if (!getHorizontalTicks(image->rows[H - 1], W, transparent, false, in do9Patch()
1051 &image->info9Patch.paddingLeft, in do9Patch()
1052 &image->info9Patch.paddingRight, &errorMsg, nullptr, in do9Patch()
1054 errorPixel = image->info9Patch.paddingLeft; in do9Patch()
1060 if (!getVerticalTicks(image->rows.data(), (W - 1) * 4, H, transparent, false, in do9Patch()
1061 &image->info9Patch.paddingTop, in do9Patch()
1062 &image->info9Patch.paddingBottom, &errorMsg, nullptr, in do9Patch()
1064 errorPixel = image->info9Patch.paddingTop; in do9Patch()
1070 getHorizontalLayoutBoundsTicks(image->rows[H - 1], W, transparent, false, in do9Patch()
1071 &image->layoutBoundsLeft, in do9Patch()
1072 &image->layoutBoundsRight, &errorMsg); in do9Patch()
1074 getVerticalLayoutBoundsTicks(image->rows.data(), (W - 1) * 4, H, transparent, in do9Patch()
1075 false, &image->layoutBoundsTop, in do9Patch()
1076 &image->layoutBoundsBottom, &errorMsg); in do9Patch()
1078 image->haveLayoutBounds = in do9Patch()
1079 image->layoutBoundsLeft != 0 || image->layoutBoundsRight != 0 || in do9Patch()
1080 image->layoutBoundsTop != 0 || image->layoutBoundsBottom != 0; in do9Patch()
1082 if (image->haveLayoutBounds) { in do9Patch()
1084 printf("layoutBounds=%d %d %d %d\n", image->layoutBoundsLeft, in do9Patch()
1085 image->layoutBoundsTop, image->layoutBoundsRight, in do9Patch()
1086 image->layoutBoundsBottom); in do9Patch()
1091 getOutline(image); in do9Patch()
1094 if (image->info9Patch.paddingLeft < 0) { in do9Patch()
1095 image->info9Patch.paddingLeft = xDivs[0]; in do9Patch()
1096 image->info9Patch.paddingRight = W - 2 - xDivs[1]; in do9Patch()
1099 image->info9Patch.paddingRight = W - 2 - image->info9Patch.paddingRight; in do9Patch()
1101 if (image->info9Patch.paddingTop < 0) { in do9Patch()
1102 image->info9Patch.paddingTop = yDivs[0]; in do9Patch()
1103 image->info9Patch.paddingBottom = H - 2 - yDivs[1]; in do9Patch()
1106 image->info9Patch.paddingBottom = H - 2 - image->info9Patch.paddingBottom; in do9Patch()
1122 newRows[i] = image->rows[i + 1]; in do9Patch()
1125 image->rows.swap(newRows); in do9Patch()
1127 image->width -= 2; in do9Patch()
1128 W = image->width; in do9Patch()
1129 image->height -= 2; in do9Patch()
1130 H = image->height; in do9Patch()
1156 image->info9Patch.numColors = numColors; in do9Patch()
1157 image->colors.resize(numColors); in do9Patch()
1195 c = getColor(image->rows.data(), left, top, right - 1, bottom - 1); in do9Patch()
1196 image->colors[colorIndex++] = c; in do9Patch()
1212 printf(" #%08x", image->colors[i]); in do9Patch()