Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | add -scaleto option to enhanced photo copy for ticket [7044332162] |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
01e4d678d793e20f559718092d6235fe |
User & Date: | chw 2019-07-04 17:43:22.674 |
Original Comment: | add -scaleto option to enhanced pÃhoto copy for ticket [7044332162] |
Context
2019-07-05
| ||
06:11 | add optional rotation to materialicons from ticket [2b90520896] check-in: 85300fa9ac user: chw tags: trunk | |
2019-07-04
| ||
17:43 | add -scaleto option to enhanced photo copy for ticket [7044332162] check-in: 01e4d678d7 user: chw tags: trunk | |
15:31 | add tcl upstream changes check-in: abe9b6607a user: chw tags: trunk | |
Changes
Changes to jni/sdl2tk/generic/tkImgPhoto.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 | Tcl_Obj *name; /* Name specified without an option. */ int fromX, fromY; /* Values specified for -from option. */ int fromX2, fromY2; /* Second coordinate pair for -from option. */ int toX, toY; /* Values specified for -to option. */ int toX2, toY2; /* Second coordinate pair for -to option. */ int zoomX, zoomY; /* Values specified for -zoom option. */ int subsampleX, subsampleY; /* Values specified for -subsample option. */ | | | > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | Tcl_Obj *name; /* Name specified without an option. */ int fromX, fromY; /* Values specified for -from option. */ int fromX2, fromY2; /* Second coordinate pair for -from option. */ int toX, toY; /* Values specified for -to option. */ int toX2, toY2; /* Second coordinate pair for -to option. */ int zoomX, zoomY; /* Values specified for -zoom option. */ int subsampleX, subsampleY; /* Values specified for -subsample option. */ double rotate; /* Degrees to rotate the image with. */ double scaleX, scaleY; /* Resize factors in the X and Y directions. */ int stoX, stoY; /* Target width/height for -scaleto option. */ int mirrorX, mirrorY; /* 1 if mirroring the resp. axis requested */ char *filtername; /* Name of the interpolating lowpass filter. */ int smoothedge; /* Pixel width of frame used in edge smoothing: * default value is 0 (means no smoothing) * and 1 may be specified in the Tcl command. */ double blur; /* Defines the effect of blurring the image, * must be > 1.0 */ Tcl_Obj *format; /* Value specified for -format option. */ XColor *background; /* Value specified for -background option. */ |
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | * OPT_ZOOM: Set if -zoom option allowed/specified. * OPT_ROTATE: Set if -rotate option allowed/specified. * OPT_SCALE: Set if -scale option allowed/specified. * OPT_MIRROR: Set if -mirror option allowed/specified. * OPT_FILTER: Set if -filter option allowed/specified. * OPT_SMOOTHEDGE: Set if -smoothedge option allowed/specified. * OPT_BLUR: Set if -blur option allowed/specified. */ #define OPT_BACKGROUND 1 #define OPT_COMPOSITE 2 #define OPT_FORMAT 4 #define OPT_FROM 8 #define OPT_GRAYSCALE 0x10 #define OPT_SHRINK 0x20 #define OPT_SUBSAMPLE 0x40 #define OPT_TO 0x80 #define OPT_ZOOM 0x100 #define OPT_ROTATE 0x200 #define OPT_SCALE 0x400 #define OPT_MIRROR 0x800 #define OPT_FILTER 0x1000 #define OPT_SMOOTHEDGE 0x2000 #define OPT_BLUR 0x4000 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ static const char *const optionNames[] = { | > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | * OPT_ZOOM: Set if -zoom option allowed/specified. * OPT_ROTATE: Set if -rotate option allowed/specified. * OPT_SCALE: Set if -scale option allowed/specified. * OPT_MIRROR: Set if -mirror option allowed/specified. * OPT_FILTER: Set if -filter option allowed/specified. * OPT_SMOOTHEDGE: Set if -smoothedge option allowed/specified. * OPT_BLUR: Set if -blur option allowed/specified. * OPT_SCALETO: Set if -scaleto option allowed/specified. */ #define OPT_BACKGROUND 1 #define OPT_COMPOSITE 2 #define OPT_FORMAT 4 #define OPT_FROM 8 #define OPT_GRAYSCALE 0x10 #define OPT_SHRINK 0x20 #define OPT_SUBSAMPLE 0x40 #define OPT_TO 0x80 #define OPT_ZOOM 0x100 #define OPT_ROTATE 0x200 #define OPT_SCALE 0x400 #define OPT_MIRROR 0x800 #define OPT_FILTER 0x1000 #define OPT_SMOOTHEDGE 0x2000 #define OPT_BLUR 0x4000 #define OPT_SCALETO 0x8000 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ static const char *const optionNames[] = { |
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | "-zoom", "-rotate", "-scale", "-mirror", "-filter", "-smoothedge", "-blur", NULL }; /* * Message to generate when an attempt to resize an image fails due to memory * problems. */ | > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | "-zoom", "-rotate", "-scale", "-mirror", "-filter", "-smoothedge", "-blur", "-scaleto", NULL }; /* * Message to generate when an attempt to resize an image fails due to memory * problems. */ |
︙ | ︙ | |||
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | */ index = 2; memset(&options, 0, sizeof(options)); options.zoomX = options.zoomY = 1; options.subsampleX = options.subsampleY = 1; options.scaleX = options.scaleY = 1; options.rotate = 0; options.mirrorX = options.mirrorY = 0; options.filtername = NULL; options.smoothedge = 0; options.blur = 0; options.name = NULL; options.compositingRule = TK_PHOTO_COMPOSITE_OVERLAY; if (ParseSubcommandOptions(&options, interp, OPT_FROM | OPT_TO | OPT_ZOOM | OPT_SUBSAMPLE | OPT_SHRINK | | > | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | */ index = 2; memset(&options, 0, sizeof(options)); options.zoomX = options.zoomY = 1; options.subsampleX = options.subsampleY = 1; options.scaleX = options.scaleY = 1; options.stoX = options.stoY = -1; options.rotate = 0; options.mirrorX = options.mirrorY = 0; options.filtername = NULL; options.smoothedge = 0; options.blur = 0; options.name = NULL; options.compositingRule = TK_PHOTO_COMPOSITE_OVERLAY; if (ParseSubcommandOptions(&options, interp, OPT_FROM | OPT_TO | OPT_ZOOM | OPT_SUBSAMPLE | OPT_SHRINK | OPT_COMPOSITE | OPT_BACKGROUND | OPT_SCALETO | OPT_ROTATE | OPT_SCALE | OPT_MIRROR | OPT_FILTER | OPT_BLUR, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.filtername == NULL) && (options.smoothedge != 0)) { options.filtername = "Mitchell"; } |
︙ | ︙ | |||
634 635 636 637 638 639 640 | Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); | | > > > > > > > > > > > > > > > > > > > > > > | > | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", Tcl_GetString(options.name), NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); if (options.options & OPT_SCALETO) { int corr; /* No rotation, no smoothedge, please. */ options.rotate = 0; options.smoothedge = 0; options.options &= ~(OPT_ROTATE | OPT_SCALE); options.toX = options.toY = 0; corr = (options.stoX > block.width) ? 2 : 1; options.scaleX = (double) options.stoX / (double) (block.width - corr); options.toX2 = options.stoX; if (options.stoY < 0) { options.scaleY = options.scaleX; options.toY2 = (int) (block.height * options.scaleY + 0.5); } else { corr = (options.stoY > block.height) ? 2 : 1; options.scaleY = (double) options.stoY / (double) (block.height - corr); options.toY2 = options.stoY; } } if (options.options & (OPT_ROTATE | OPT_SCALE | OPT_MIRROR | OPT_FILTER | OPT_SCALETO)) { int sameSrc = (block.pixelPtr == masterPtr->pix32); PhotoMaster savedMaster; savedMaster = *masterPtr; if (sameSrc) { masterPtr->pix32 = NULL; masterPtr->width = masterPtr->height = 0; |
︙ | ︙ | |||
1673 1674 1675 1676 1677 1678 1679 | } optPtr->name = objv[index]; continue; } /* * For the -from, -to, -zoom, -subsample, -background, -rotate, | | | | | 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | } optPtr->name = objv[index]; continue; } /* * For the -from, -to, -zoom, -subsample, -background, -rotate, * -scale, -filter, -mirror, -smoothedge, -blur, -scaleto options, * parse the values given. Report an error if too few or too many * values are given. */ if (bit == OPT_BACKGROUND) { /* * The -background option takes a single XColor value. */ |
︙ | ︙ | |||
1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 | } } } } else { Tcl_AppendResult(interp, "the \"-scale\" option ", "requires one or two values", (char *) NULL); return TCL_ERROR; } } else if (bit == OPT_MIRROR) { if (index + 1 < objc) { char *temp; *optIndexPtr = ++index; temp = Tcl_GetString(objv[index]); | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | } } } } else { Tcl_AppendResult(interp, "the \"-scale\" option ", "requires one or two values", (char *) NULL); return TCL_ERROR; } } else if (bit == OPT_SCALETO) { if (index + 1 < objc) { *optIndexPtr = ++index; if ((Tcl_GetIntFromObj(interp, objv[index], &optPtr->stoX) != TCL_OK) || (optPtr->stoX <= 0)) { Tcl_AppendResult(interp, "the -scaleto X value is invalid", (char *) NULL); return TCL_ERROR; } if (index + 1 < objc) { if (*(Tcl_GetString(objv[index+1])) != '-') { *optIndexPtr = ++index; if ((Tcl_GetIntFromObj(interp, objv[index], &optPtr->stoY) != TCL_OK) || (optPtr->stoY <= 0)) { Tcl_AppendResult(interp, "the -scaleto Y value is invalid", (char *) NULL); return TCL_ERROR; } } } } else { Tcl_AppendResult(interp, "the \"-scaleto\" option ", "requires one or two values", (char *) NULL); return TCL_ERROR; } } else if (bit == OPT_MIRROR) { if (index + 1 < objc) { char *temp; *optIndexPtr = ++index; temp = Tcl_GetString(objv[index]); |
︙ | ︙ |
jni/tcl/library/msgs/ja.msg became executable.
︙ | ︙ |