Changeset 2160 for trunk/src/user32/uitools.cpp
- Timestamp:
- Dec 20, 1999, 5:45:18 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/uitools.cpp
r2093 r2160 1 /* $Id: uitools.cpp,v 1.1 8 1999-12-16 16:53:57cbratschi Exp $ */1 /* $Id: uitools.cpp,v 1.19 1999-12-20 16:45:16 cbratschi Exp $ */ 2 2 /* 3 3 * User Interface Functions … … 1650 1650 1651 1651 if (!GetIconInfo(hIcon,&ii)) return FALSE; 1652 GetObjectA(ii.hbmColor,sizeof(BITMAP),(LPVOID)&bmp);1653 1652 oldFg = SetTextColor(hDC,RGB(0,0,0)); 1654 1653 oldBg = SetBkColor(hDC,RGB(255,255,255)); 1655 1654 hMemDC = CreateCompatibleDC(hDC); 1656 1655 oldBmp = SelectObject(hMemDC,ii.hbmMask); 1657 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCAND); 1658 SelectObject(hMemDC,ii.hbmColor); 1659 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCPAINT); 1660 SelectObject(hMemDC,ii.hbmMask); 1661 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight,hMemDC,0,bmp.bmHeight,SRCINVERT); 1656 if (ii.hbmColor) 1657 { 1658 GetObjectA(ii.hbmColor,sizeof(BITMAP),(LPVOID)&bmp); 1659 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCAND); 1660 SelectObject(hMemDC,ii.hbmColor); 1661 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCINVERT); 1662 } else 1663 { 1664 GetObjectA(ii.hbmMask,sizeof(BITMAP),(LPVOID)&bmp); 1665 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight/2,hMemDC,0,0,SRCAND); 1666 BitBlt(hDC,X,Y,bmp.bmWidth,bmp.bmHeight/2,hMemDC,0,bmp.bmHeight/2,SRCINVERT); 1667 } 1662 1668 SelectObject(hMemDC,oldBmp); 1663 1669 DeleteObject(hMemDC); 1670 if (ii.hbmColor) DeleteObject(ii.hbmColor); 1671 if (ii.hbmMask) DeleteObject(ii.hbmMask); 1664 1672 SetTextColor(hDC,oldFg); 1665 1673 SetBkColor(hDC,oldBg); … … 1694 1702 1695 1703 if (!GetIconInfo(hIcon,&ii)) return FALSE; 1696 GetObjectA(ii.hbmColor,sizeof(BITMAP),(LPVOID)&bmp); 1704 if (ii.hbmColor) 1705 GetObjectA(ii.hbmColor,sizeof(BITMAP),(LPVOID)&bmp); 1706 else 1707 GetObjectA(ii.hbmMask,sizeof(BITMAP),(LPVOID)&bmp); 1697 1708 1698 1709 /* Calculate the size of the destination image. */ 1699 if ( cxWidth == 0)1710 if (diFlags & DI_DEFAULTSIZE) 1700 1711 { 1701 if (diFlags & DI_DEFAULTSIZE) 1702 cxWidth = GetSystemMetrics(SM_CXICON); 1703 else 1704 cxWidth = bmp.bmWidth; 1705 } 1706 if (cyWidth == 0) 1712 cxWidth = GetSystemMetrics(SM_CXICON); 1713 cyWidth = GetSystemMetrics(SM_CYICON); 1714 } else if (cxWidth == 0) 1707 1715 { 1708 if (diFlags & DI_DEFAULTSIZE)1709 cyWidth = GetSystemMetrics(SM_CYICON);1710 else1711 cyWidth = bmp.bmHeight;1716 cxWidth = bmp.bmWidth; 1717 } else if (cyWidth == 0) 1718 { 1719 cyWidth = ii.hbmColor ? bmp.bmHeight:bmp.bmHeight/2; 1712 1720 } 1713 1721 … … 1729 1737 oldBmp = SelectObject(hMemDC,ii.hbmMask); 1730 1738 oldStretchMode = SetStretchBltMode(hBmpDC,STRETCH_DELETESCANS); 1731 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCAND); 1732 SelectObject(hMemDC,ii.hbmColor); 1733 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCPAINT); 1734 SelectObject(hMemDC,ii.hbmMask); 1735 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,bmp.bmHeight,bmp.bmWidth,bmp.bmHeight,SRCINVERT); 1739 if (ii.hbmColor) 1740 { 1741 if (diFlags & DI_MASK) 1742 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCAND); 1743 if (diFlags & DI_IMAGE) 1744 { 1745 SelectObject(hMemDC,ii.hbmColor); 1746 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCINVERT); 1747 } 1748 } else if (diFlags & DI_MASK) 1749 { 1750 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight/2,SRCAND); 1751 StretchBlt(hBmpDC,0,0,cxWidth,cyWidth,hMemDC,0,bmp.bmHeight/2,bmp.bmWidth,bmp.bmHeight/2,SRCINVERT); 1752 } 1736 1753 BitBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hBmpDC,0,0,SRCCOPY); 1737 1754 SelectObject(hMemDC,oldBmp); … … 1750 1767 oldBmp = SelectObject(hMemDC,ii.hbmMask); 1751 1768 oldStretchMode = SetStretchBltMode(hdc,STRETCH_DELETESCANS); 1752 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCAND); 1753 SelectObject(hMemDC,ii.hbmColor); 1754 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCPAINT); 1755 SelectObject(hMemDC,ii.hbmMask); 1756 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,bmp.bmHeight,bmp.bmWidth,bmp.bmHeight,SRCINVERT); 1769 if (ii.hbmColor) 1770 { 1771 if (diFlags & DI_MASK) 1772 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCAND); 1773 if (diFlags & DI_IMAGE) 1774 { 1775 SelectObject(hMemDC,ii.hbmColor); 1776 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCINVERT); 1777 } 1778 } else if (diFlags & DI_MASK) 1779 { 1780 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCAND); 1781 StretchBlt(hdc,xLeft,yTop,cxWidth,cyWidth,hMemDC,0,bmp.bmHeight/2,bmp.bmWidth,bmp.bmHeight/2,SRCINVERT); 1782 } 1757 1783 SelectObject(hMemDC,oldBmp); 1758 1784 DeleteObject(hMemDC); … … 1761 1787 SetStretchBltMode(hdc,oldStretchMode); 1762 1788 } 1789 if (ii.hbmColor) DeleteObject(ii.hbmColor); 1790 if (ii.hbmMask) DeleteObject(ii.hbmMask); 1763 1791 1764 1792 return TRUE;
Note:
See TracChangeset
for help on using the changeset viewer.