… | |
… | |
52 | * adjustment and may optionally be followed by a colon and one or more |
52 | * adjustment and may optionally be followed by a colon and one or more |
53 | * colon-delimited pixmap operations. |
53 | * colon-delimited pixmap operations. |
54 | * The following table shows the valid geometry strings and their |
54 | * The following table shows the valid geometry strings and their |
55 | * effects on the background image : |
55 | * effects on the background image : |
56 | * |
56 | * |
57 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
57 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
58 | * W and H are percentages of the terminal window size. |
58 | * W and H are percentages of the terminal window size. |
59 | * X and Y are also percentages; e.g., +50+50 centers |
59 | * X and Y are also percentages; e.g., +50+50 centers |
60 | * the image in the window. |
60 | * the image in the window. |
61 | * WxH+X Assumes Y == X |
61 | * WxH+X Assumes Y == X |
62 | * WxH Assumes Y == X == 50 (centers the image) |
62 | * WxH Assumes Y == X == 50 (centers the image) |
63 | * W+X+Y Assumes H == W |
63 | * W+X+Y Assumes H == W |
64 | * W+X Assumes H == W and Y == X |
64 | * W+X Assumes H == W and Y == X |
65 | * W Assumes H == W and Y == X == 50 |
65 | * W Assumes H == W and Y == X == 50 |
66 | * |
66 | * |
67 | * Adjusting position only : |
67 | * Adjusting position only : |
68 | * =+X+Y Set position to X% by Y% (absolute). |
68 | * =+X+Y Set position to X% by Y% (absolute). |
69 | * =+X Set position to X% by X%. |
69 | * =+X Set position to X% by X%. |
70 | * +X+Y Adjust position horizontally X% and vertically Y% |
70 | * +X+Y Adjust position horizontally X% and vertically Y% |
71 | * from current position (relative). |
71 | * from current position (relative). |
72 | * +X Adjust position horizontally X% and vertically X% |
72 | * +X Adjust position horizontally X% and vertically X% |
73 | * from current position. |
73 | * from current position. |
74 | * |
74 | * |
75 | * Adjusting scale only : |
75 | * Adjusting scale only : |
76 | * Wx0 Multiply horizontal scaling factor by W% |
76 | * Wx0 Multiply horizontal scaling factor by W% |
77 | * 0xH Multiply vertical scaling factor by H% |
77 | * 0xH Multiply vertical scaling factor by H% |
78 | * 0x0 No scaling (show image at normal size). |
78 | * 0x0 No scaling (show image at normal size). |
79 | * |
79 | * |
80 | * Pixmap Operations : (should be prepended by a colon) |
80 | * Pixmap Operations : (should be prepended by a colon) |
81 | * tile Tile image. Scaling/position modifiers above will affect |
81 | * tile Tile image. Scaling/position modifiers above will affect |
82 | * the tile size and origin. |
82 | * the tile size and origin. |
83 | * propscale When scaling, scale proportionally. That is, maintain the |
83 | * propscale When scaling, scale proportionally. That is, maintain the |
84 | * proper aspect ratio for the image. Any portion of the |
84 | * proper aspect ratio for the image. Any portion of the |
85 | * background not covered by the image is filled with the |
85 | * background not covered by the image is filled with the |
86 | * current background color. |
86 | * current background color. |
87 | * hscale Scale horizontally, tile vertically ? |
87 | * hscale Scale horizontally, tile vertically ? |
88 | * vscale Tile horizontally, scale vertically ? |
88 | * vscale Tile horizontally, scale vertically ? |
… | |
… | |
642 | free (layers); |
642 | free (layers); |
643 | } |
643 | } |
644 | } |
644 | } |
645 | TIMING_TEST_PRINT_RESULT (asim); |
645 | TIMING_TEST_PRINT_RESULT (asim); |
646 | |
646 | |
647 | if (pixmap) |
647 | bool ret = false; |
648 | { |
|
|
649 | if (result == NULL |
|
|
650 | || pmap_width != new_pmap_width |
|
|
651 | || pmap_height != new_pmap_height |
|
|
652 | || pmap_depth != target->depth) |
|
|
653 | { |
|
|
654 | XFreePixmap (target->dpy, pixmap); |
|
|
655 | pixmap = None; |
|
|
656 | } |
|
|
657 | } |
|
|
658 | |
648 | |
659 | if (result) |
649 | if (result) |
660 | { |
650 | { |
661 | XGCValues gcv; |
651 | XGCValues gcv; |
662 | GC gc; |
652 | GC gc; |
|
|
653 | |
|
|
654 | if (pixmap) |
|
|
655 | { |
|
|
656 | if (pmap_width != new_pmap_width |
|
|
657 | || pmap_height != new_pmap_height |
|
|
658 | || pmap_depth != target->depth) |
|
|
659 | { |
|
|
660 | XFreePixmap (target->dpy, pixmap); |
|
|
661 | pixmap = None; |
|
|
662 | } |
|
|
663 | } |
663 | |
664 | |
664 | /* create Pixmap */ |
665 | /* create Pixmap */ |
665 | if (pixmap == None) |
666 | if (pixmap == None) |
666 | { |
667 | { |
667 | pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); |
668 | pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); |
… | |
… | |
693 | if (result != background && result != original_asim) |
694 | if (result != background && result != original_asim) |
694 | destroy_asimage (&result); |
695 | destroy_asimage (&result); |
695 | |
696 | |
696 | XFreeGC (target->dpy, gc); |
697 | XFreeGC (target->dpy, gc); |
697 | TIMING_TEST_PRINT_RESULT (asim); |
698 | TIMING_TEST_PRINT_RESULT (asim); |
|
|
699 | |
|
|
700 | ret = true; |
698 | } |
701 | } |
699 | |
702 | |
700 | if (background) |
703 | if (background) |
701 | destroy_asimage (&background); |
704 | destroy_asimage (&background); |
702 | |
705 | |
703 | return true; |
706 | return ret; |
704 | } |
707 | } |
705 | # endif /* HAVE_AFTERIMAGE */ |
708 | # endif /* HAVE_AFTERIMAGE */ |
706 | |
709 | |
707 | bool |
710 | bool |
708 | bgPixmap_t::set_file (const char *file) |
711 | bgPixmap_t::set_file (const char *file) |
… | |
… | |
754 | int changed = 0; |
757 | int changed = 0; |
755 | unsigned int hr, vr; |
758 | unsigned int hr, vr; |
756 | int junk; |
759 | int junk; |
757 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
760 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
758 | |
761 | |
759 | if (!(geom_flags&WidthValue)) |
762 | if (!(geom_flags & WidthValue)) |
760 | hr = 1; |
763 | hr = 1; |
761 | if (!(geom_flags&HeightValue)) |
764 | if (!(geom_flags & HeightValue)) |
762 | vr = hr; |
765 | vr = hr; |
763 | |
766 | |
764 | if (h_blurRadius != hr) |
767 | if (h_blurRadius != hr) |
765 | { |
768 | { |
766 | ++changed; |
769 | ++changed; |
… | |
… | |
776 | if (v_blurRadius == 0 && h_blurRadius == 0) |
779 | if (v_blurRadius == 0 && h_blurRadius == 0) |
777 | flags &= ~blurNeeded; |
780 | flags &= ~blurNeeded; |
778 | else |
781 | else |
779 | flags |= blurNeeded; |
782 | flags |= blurNeeded; |
780 | |
783 | |
781 | return (changed>0); |
784 | return (changed > 0); |
782 | } |
785 | } |
783 | |
786 | |
784 | static inline unsigned long |
787 | static inline unsigned long |
785 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
788 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
786 | { |
789 | { |
… | |
… | |
844 | { |
847 | { |
845 | unsigned long new_flags = compute_tint_shade_flags (NULL, shade); |
848 | unsigned long new_flags = compute_tint_shade_flags (NULL, shade); |
846 | |
849 | |
847 | if (new_flags != (flags & tintFlags)) |
850 | if (new_flags != (flags & tintFlags)) |
848 | { |
851 | { |
849 | flags = (flags&~tintFlags)|new_flags; |
852 | flags = (flags & ~tintFlags) | new_flags; |
850 | return true; |
853 | return true; |
851 | } |
854 | } |
852 | |
855 | |
853 | return false; |
856 | return false; |
854 | } |
857 | } |