Lines Matching refs:image
33 // This holds an image as 8bpp RGBA.
78 //printf("Image %s:\n", imageName);
121 NOISY(printf("Image %s: w=%d, h=%d, d=%d, colors=%d, inter=%d, comp=%d\n",
314 static uint32_t get_color(image_info* image, int hpatch, int vpatch)
318 hpatch, image->info9Patch.xDivs[0], image->info9Patch.xDivs[1],
319 image->width, &left, &right);
321 vpatch, image->info9Patch.yDivs[0], image->info9Patch.yDivs[1],
322 image->height, &top, &bottom);
325 const uint32_t c = get_color(image->rows, left, top, right, bottom);
330 static status_t do_9patch(const char* imageName, image_info* image)
332 image->is9Patch = true;
334 int W = image->width;
335 int H = image->height;
353 image->info9Patch.paddingLeft = image->info9Patch.paddingRight =
354 image->info9Patch.paddingTop = image->info9Patch.paddingBottom = -1;
356 png_bytep p = image->rows[0];
368 errorMsg = "Image must be at least 3x3 (1x1 without frame) pixels";
388 if (get_vertical_ticks(image->rows, 0, H, transparent, true, &yDivs[0],
396 if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
397 &image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
398 errorPixel = image->info9Patch.paddingLeft;
404 if (get_vertical_ticks(image->rows, (W-1)*4, H, transparent, false, &image->info9Patch.paddingTop,
405 &image->info9Patch.paddingBottom, &errorMsg, NULL, false) != NO_ERROR) {
406 errorPixel = image->info9Patch.paddingTop;
411 // Copy patch data into image
412 image->info9Patch.numXDivs = numXDivs;
413 image->info9Patch.numYDivs = numYDivs;
414 image->info9Patch.xDivs = xDivs;
415 image->info9Patch.yDivs = yDivs;
418 if (image->info9Patch.paddingLeft < 0) {
419 image->info9Patch.paddingLeft = xDivs[0];
420 image->info9Patch.paddingRight = W - 2 - xDivs[1];
423 image->info9Patch.paddingRight = W - 2 - image->info9Patch.paddingRight;
425 if (image->info9Patch.paddingTop < 0) {
426 image->info9Patch.paddingTop = yDivs[0];
427 image->info9Patch.paddingBottom = H - 2 - yDivs[1];
430 image->info9Patch.paddingBottom = H - 2 - image->info9Patch.paddingBottom;
434 image->info9Patch.xDivs[0], image->info9Patch.xDivs[1],
435 image->info9Patch.yDivs[0], image->info9Patch.yDivs[1]));
437 image->info9Patch.paddingLeft, image->info9Patch.paddingRight,
438 image->info9Patch.paddingTop, image->info9Patch.paddingBottom));
440 // Remove frame from image.
441 image->rows = (png_bytepp)malloc((H-2) * png_sizeof(png_bytep));
443 image->rows[i] = image->allocRows[i+1];
444 memmove(image->rows[i], image->rows[i]+4, (W-2)*4);
446 image->width -= 2;
447 W = image->width;
448 image->height -= 2;
449 H = image->height;
475 image->info9Patch.numColors = numColors;
476 image->info9Patch.colors = (uint32_t*)malloc(numColors * sizeof(uint32_t));
518 c = get_color(image->rows, left, top, right - 1, bottom - 1);
519 image->info9Patch.colors[colorIndex++] = c;
531 image->info9Patch.colors[i]);
536 image->is9Patch = true;
537 image->info9Patch.deviceToFile();
542 "ERROR: 9-patch image %s malformed.\n"
684 // Scan the entire image and determine if:
689 // NOISY(printf("Initial image data:\n"));
710 // Check if image is really grayscale
719 // Check if image is really opaque
728 // Check if image is really <= 256 colors
767 // Choose the best color type for the image.
791 printf("%s: forcing image to gray (max deviation = %d)\n", imageName, maxGrayDeviation);
798 // Perform postprocessing of the image or palette data based on the final
814 // If the image is gray or gray + alpha, compact the pixels into outRows
866 NOISY(printf("Writing image %s: w = %d, h = %d\n", imageName,
877 // If the image is a 9-patch, we need to preserve it as a ARGB file to make
886 NOISY(printf("Image %s has %d colors%s, using PNG_COLOR_TYPE_PALETTE\n",
891 NOISY(printf("Image %s is opaque gray, using PNG_COLOR_TYPE_GRAY\n", imageName));
894 NOISY(printf("Image %s is gray + alpha, using PNG_COLOR_TYPE_GRAY_ALPHA\n", imageName));
897 NOISY(printf("Image %s is opaque RGB, using PNG_COLOR_TYPE_RGB\n", imageName));
900 NOISY(printf("Image %s is RGB + alpha, using PNG_COLOR_TYPE_RGB_ALPHA\n", imageName));
947 // NOISY(printf("Final image data:\n"));
962 NOISY(printf("Image written: w=%d, h=%d, d=%d, colors=%d, inter=%d, comp=%d\n",
1062 printf(" (processed image %s: %d%% size of source)\n", printableName.string(), percent);
1077 fprintf(stderr, "ERROR: Failure processing PNG image %s\n",