Changeset 195 for trunk/src/helpers/gpih.c
- Timestamp:
- Aug 5, 2002, 8:57:15 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/gpih.c
r191 r195 2507 2507 * replacement for WinDrawPointer that can do clipping. 2508 2508 * 2509 * To do clipping with WinDrawPointer, one has to 2510 * alter the clip rectangle for the current HPS, 2511 * which involves creating regions and is thus quite 2512 * some overhead. 2513 * 2514 * Instead, this function allows for specifying a clip 2515 * rectangle directly. Besides, since it uses GpiWCBitBlt, 2516 * it should probably work with all types of device contexts. 2509 * Normally, to do clipping with WinDrawPointer, one 2510 * would have to alter the clip rectangle for the current 2511 * HPS, which requires creating regions and is thus quite 2512 * expensive. 2513 * 2514 * Instead, this function allows for specifying a clip 2515 * rectangle directly. It blits the icon bitmaps directly 2516 * without calling WinDrawPointer. 2517 * Besides, since it uses GpiWCBitBlt, it should probably 2518 * work with all types of device contexts. 2517 2519 * 2518 2520 * This also replaces gpihIcon2Bitmap, which wasn't quite … … 2522 2524 * If you don't need clipping and are drawing to the 2523 2525 * screen only, this function has no advantage over 2524 * WinDrawPointer because it's presumably slower.2526 * WinDrawPointer because it's presumably a bit slower. 2525 2527 * 2526 2528 * Flags presently supported in fl: … … 2528 2530 * -- DP_MINI (not DP_MINIICON, as stated in PMREF): 2529 2531 * use mini-icon. 2532 * 2533 * -- DP_HALFTONED (V0.9.20) 2530 2534 * 2531 2535 * Preconditions: … … 2540 2544 * 2541 2545 *@@added V0.9.19 (2002-06-18) [umoeller] 2546 *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader 2547 *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED 2542 2548 */ 2543 2549 … … 2559 2565 POINTL aptl[4]; 2560 2566 HBITMAP hbmThis; 2561 BITMAPINFOHEADER2 bmi; 2567 BITMAPINFOHEADER2 bmiAndXor, 2568 bmiColor; 2562 2569 2563 2570 // A HPOINTER really consists of two bitmaps, … … 2645 2652 GpiSetBackColor(hps, RGBCOL_BLACK); 2646 2653 2654 if (fl & DP_HALFTONED) // V0.9.20 (2002-08-04) [umoeller] 2655 GpiSetPattern(hps, PATSYM_HALFTONE); 2656 2647 2657 /* 2648 2658 * 1) work on the AND image … … 2656 2666 ) 2657 2667 { 2658 bmi .cbFix = sizeof(bmi);2659 GpiQueryBitmapInfoHeader(hbmThis, &bmi );2668 bmiAndXor.cbFix = sizeof(bmiAndXor); 2669 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor); 2660 2670 2661 2671 // use only half the bitmap height 2662 cySrc = bmi .cy / 2;2672 cySrc = bmiAndXor.cy / 2; 2663 2673 2664 2674 // aptl[2]: source bottom-left 2665 2675 aptl[2].x = 0 2666 + lClipLeft * bmi .cx / cxIcon;2676 + lClipLeft * bmiAndXor.cx / cxIcon; 2667 2677 aptl[2].y = cySrc 2668 2678 + lClipBottom * cySrc / cyIcon; 2669 2679 2670 2680 // aptl[3]: source top-right (exclusive!) 2671 aptl[3].x = bmi .cx2672 - lClipRight * bmi .cx / cxIcon;2673 aptl[3].y = bmi .cy2681 aptl[3].x = bmiAndXor.cx 2682 - lClipRight * bmiAndXor.cx / cxIcon; 2683 aptl[3].y = bmiAndXor.cy 2674 2684 - lClipTop * cySrc / cyIcon; 2675 2685 … … 2693 2703 ) 2694 2704 { 2695 bmi .cbFix = sizeof(bmi);2696 GpiQueryBitmapInfoHeader(hbmThis, &bmi );2705 bmiColor.cbFix = sizeof(bmiColor); 2706 GpiQueryBitmapInfoHeader(hbmThis, &bmiColor); 2697 2707 2698 2708 // aptl[2]: source bottom-left 2699 2709 aptl[2].x = 0 2700 + lClipLeft * bmi .cx / cxIcon;2710 + lClipLeft * bmiColor.cx / cxIcon; 2701 2711 aptl[2].y = 0 2702 + lClipBottom * bmi .cy / cyIcon;2712 + lClipBottom * bmiColor.cy / cyIcon; 2703 2713 2704 2714 // aptl[3]: source top-right (exclusive!) 2705 aptl[3].x = bmi .cx2706 - lClipRight * bmi .cx / cxIcon;2707 aptl[3].y = bmi .cy2708 - lClipTop * bmi .cy / cyIcon;2715 aptl[3].x = bmiColor.cx 2716 - lClipRight * bmiColor.cx / cxIcon; 2717 aptl[3].y = bmiColor.cy 2718 - lClipTop * bmiColor.cy / cyIcon; 2709 2719 2710 2720 GpiWCBitBlt(hps, // target … … 2727 2737 ) 2728 2738 { 2729 bmi.cbFix = sizeof(bmi); 2730 GpiQueryBitmapInfoHeader(hbmThis, &bmi); 2739 /* we queried this one above V0.9.20 (2002-07-31) [umoeller] 2740 bmiAndXor.cbFix = sizeof(bmiAndXor); 2741 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor); 2742 */ 2731 2743 2732 2744 // use only half the bitmap height 2733 cySrc = bmi .cy / 2;2745 cySrc = bmiAndXor.cy / 2; 2734 2746 2735 2747 // aptl[2]: source bottom-left 2736 2748 aptl[2].x = 0 2737 + lClipLeft * bmi .cx / cxIcon;2749 + lClipLeft * bmiAndXor.cx / cxIcon; 2738 2750 aptl[2].y = 0 2739 2751 + lClipBottom * cySrc / cyIcon; 2740 2752 2741 2753 // aptl[3]: source top-right (exclusive!) 2742 aptl[3].x = bmi .cx2743 - lClipRight * bmi .cx / cxIcon;2754 aptl[3].x = bmiAndXor.cx 2755 - lClipRight * bmiAndXor.cx / cxIcon; 2744 2756 aptl[3].y = cySrc 2745 2757 - lClipTop * cySrc / cyIcon;
Note:
See TracChangeset
for help on using the changeset viewer.