home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / win32-wingdi.adb < prev    next >
Encoding:
Text File  |  1995-11-17  |  2.8 KB  |  84 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/win32-wingdi.adb,v $ 
  2. -- $Revision: 1.4 $ $Date: 95/02/02 15:58:43 $ $Author: mg $ 
  3. -------------------------------------------------------------------------------
  4. --
  5. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS FURNISHED "AS IS" WITHOUT 
  6. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
  7. -- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 
  8. -- PURPOSE.  The user assumes the entire risk as to the accuracy and the 
  9. -- use of this file.
  10. --
  11. -- Copyright (c) Intermetrics, Inc. 1995
  12. -- Royalty-free, unlimited, worldwide, non-exclusive use, modification, 
  13. -- reproduction and further distribution of this file is permitted.
  14. --
  15. -------------------------------------------------------------------------------
  16.  
  17.  
  18. with Win32.Utils;
  19.  
  20. package body Win32.Wingdi is
  21.  
  22.     function MAKEROP4(Fore, Back: DWORD) return DWORD is
  23.         use Interfaces;
  24.     begin
  25.         return DWORD(((Shift_Left(Unsigned_32(Back), 8)) and 16#ff00_0000#) or 
  26.            Unsigned_32(Fore));
  27.     end MAKEROP4;
  28.  
  29.     function MAKEPOINTS(dwValue: DWORD) return Win32.Windef.POINTS is
  30.         Res: Win32.Windef.POINTS;
  31.         use Win32.Utils;
  32.     begin
  33.         Res.X := SHORT(LOWORD(dwValue));
  34.         Res.Y := SHORT(HIWORD(dwValue));
  35.         return Res;
  36.     end MAKEPOINTS;
  37.  
  38.     function RGB(bRed, bGreen, bBlue: BYTE)
  39.         return Win32.Windef.COLORREF is
  40.         use Win32.Utils;
  41.     begin
  42.         return Win32.Windef.COLORREF(
  43.             MAKELONG(Low  => MAKEWORD(Low => bRed,  High => bGreen),
  44.                      High => MAKEWORD(Low => bBlue, High => 0)));
  45.     end RGB;
  46.  
  47.     function PALETTERGB(bRed, bGreen, bBlue: BYTE)
  48.         return Win32.Windef.COLORREF is
  49.         use Win32.Utils;
  50.     begin
  51.         return Win32.Windef.COLORREF(
  52.             MAKELONG(Low  => MAKEWORD(Low => bRed,  High => bGreen),
  53.                      High => MAKEWORD(Low => bBlue, High => 2)));
  54.     end PALETTERGB;
  55.  
  56.     function PALETTEINDEX(wPaletteIndex: WORD)
  57.         return Win32.Windef.COLORREF is
  58.         use Win32.Utils;
  59.     begin
  60.         return Win32.Windef.COLORREF(
  61.             MAKELONG(Low  => wPaletteIndex,
  62.                      High => 16#0100#));
  63.     end PALETTEINDEX;
  64.  
  65.     function GetRValue(rgb: Win32.Windef.COLORREF) return BYTE is
  66.         use Win32.Utils;
  67.     begin
  68.         return LOBYTE(LOWORD(Win32.Utils.DWORD(rgb)));
  69.     end GetRValue;
  70.  
  71.     function GetGValue(rgb: Win32.Windef.COLORREF) return BYTE is
  72.         use Win32.Utils;
  73.     begin
  74.         return HIBYTE(LOWORD(Win32.Utils.DWORD(rgb)));
  75.     end GetGValue;
  76.  
  77.     function GetBValue(rgb: Win32.Windef.COLORREF) return BYTE is
  78.         use Win32.Utils;
  79.     begin
  80.         return LOBYTE(HIWORD(Win32.Utils.DWORD(rgb)));
  81.     end GetBValue;
  82.  
  83. end Win32.Wingdi;
  84.