Lines Matching refs:image

33 // This holds an image as 8bpp RGBA.
427 static uint32_t get_color(image_info* image, int hpatch, int vpatch)
431 hpatch, image->info9Patch.xDivs[0], image->info9Patch.xDivs[1],
432 image->width, &left, &right);
434 vpatch, image->info9Patch.yDivs[0], image->info9Patch.yDivs[1],
435 image->height, &top, &bottom);
438 const uint32_t c = get_color(image->rows, left, top, right, bottom);
443 static status_t do_9patch(const char* imageName, image_info* image)
445 image->is9Patch = true;
447 int W = image->width;
448 int H = image->height;
466 image->info9Patch.paddingLeft = image->info9Patch.paddingRight =
467 image->info9Patch.paddingTop = image->info9Patch.paddingBottom = -1;
469 image->layoutBoundsLeft = image->layoutBoundsRight =
470 image->layoutBoundsTop = image->layoutBoundsBottom = 0;
472 png_bytep p = image->rows[0];
504 if (get_vertical_ticks(image->rows, 0, H, transparent, true, &yDivs[0],
512 if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
513 &image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
514 errorPixel = image->info9Patch.paddingLeft;
520 if (get_vertical_ticks(image->rows, (W-1)*4, H, transparent, false, &image->info9Patch.paddingTop,
521 &image->info9Patch.paddingBottom, &errorMsg, NULL, false) != NO_ERROR) {
522 errorPixel = image->info9Patch.paddingTop;
528 get_horizontal_layout_bounds_ticks(image->rows[H-1], W, transparent, false,
529 &image->layoutBoundsLeft,
530 &image->layoutBoundsRight, &errorMsg);
532 get_vertical_layout_bounds_ticks(image->rows, (W-1)*4, H, transparent, false,
533 &image->layoutBoundsTop,
534 &image->layoutBoundsBottom, &errorMsg);
536 image->haveLayoutBounds = image->layoutBoundsLeft != 0
537 || image->layoutBoundsRight != 0
538 || image->layoutBoundsTop != 0
539 || image->layoutBoundsBottom != 0;
541 if (image->haveLayoutBounds) {
542 NOISY(printf("layoutBounds=%d %d %d %d\n", image->layoutBoundsLeft, image->layoutBoundsTop,
543 image->layoutBoundsRight, image->layoutBoundsBottom));
546 // Copy patch data into image
547 image->info9Patch.numXDivs = numXDivs;
548 image->info9Patch.numYDivs = numYDivs;
549 image->info9Patch.xDivs = xDivs;
550 image->info9Patch.yDivs = yDivs;
553 if (image->info9Patch.paddingLeft < 0) {
554 image->info9Patch.paddingLeft = xDivs[0];
555 image->info9Patch.paddingRight = W - 2 - xDivs[1];
558 image->info9Patch.paddingRight = W - 2 - image->info9Patch.paddingRight;
560 if (image->info9Patch.paddingTop < 0) {
561 image->info9Patch.paddingTop = yDivs[0];
562 image->info9Patch.paddingBottom = H - 2 - yDivs[1];
565 image->info9Patch.paddingBottom = H - 2 - image->info9Patch.paddingBottom;
569 image->info9Patch.xDivs[0], image->info9Patch.xDivs[1],
570 image->info9Patch.yDivs[0], image->info9Patch.yDivs[1]));
572 image->info9Patch.paddingLeft, image->info9Patch.paddingRight,
573 image->info9Patch.paddingTop, image->info9Patch.paddingBottom));
575 // Remove frame from image.
576 image->rows = (png_bytepp)malloc((H-2) * png_sizeof(png_bytep));
578 image->rows[i] = image->allocRows[i+1];
579 memmove(image->rows[i], image->rows[i]+4, (W-2)*4);
581 image->width -= 2;
582 W = image->width;
583 image->height -= 2;
584 H = image->height;
610 image->info9Patch.numColors = numColors;
611 image->info9Patch.colors = (uint32_t*)malloc(numColors * sizeof(uint32_t));
653 c = get_color(image->rows, left, top, right - 1, bottom - 1);
654 image->info9Patch.colors[colorIndex++] = c;
666 printf(" #%08x", image->info9Patch.colors[i]);
671 image->is9Patch = true;
672 image->info9Patch.deviceToFile();
677 "ERROR: 9-patch image %s malformed.\n"
819 // Scan the entire image and determine if:
824 // NOISY(printf("Initial image data:\n"));
845 // Check if image is really grayscale
854 // Check if image is really opaque
863 // Check if image is really <= 256 colors
902 // Choose the best color type for the image.
926 printf("%s: forcing image to gray (max deviation = %d)\n", imageName, maxGrayDeviation);
933 // Perform postprocessing of the image or palette data based on the final
949 // If the image is gray or gray + alpha, compact the pixels into outRows
1002 NOISY(printf("Writing image %s: w = %d, h = %d\n", imageName,
1013 // If the image is a 9-patch, we need to preserve it as a ARGB file to make
1102 // NOISY(printf("Final image data:\n"));
1140 printf("Processing image: %s\n", printableName.string());
1222 printf(" (processed image %s: %d%% size of source)\n", printableName.string(), percent);
1237 fprintf(stderr, "ERROR: Failure processing PNG image %s\n",
1258 printf("Processing image to cache: %s => %s\n", source.string(), dest.string());
1268 // Call libpng to get a struct to read image data into
1276 // Call libpng to get a struct to read image info into
1312 // Call libpng to create a structure to hold the processed image data
1320 // Call libpng to create a structure to hold processed image info that can
1359 printf(" (processed image to cache entry %s: %d%% size of source)\n",