| Last change
 on this file since 4630 was             2174, checked in by hugh, 26 years ago | 
        
          | 
Added ODIn lic header with ID to all files where missing
 
Cleaned up Surface handling by movefing colorfill andcolorconversion into own files and use functionpointers
 setup during creation.
 
 
updated makefile to add files
 
removed inhertiance from IBASE in DDrectangle class
 | 
        
          | File size:
            1.5 KB | 
      
      
| Line |  | 
|---|
| 1 | /* $Id: rectangle.cpp,v 1.3 1999-12-21 01:28:17 hugh Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Rectangle class Implementaion | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Markus Montkowski | 
|---|
| 7 | * | 
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 9 | * | 
|---|
| 10 | */ | 
|---|
| 11 |  | 
|---|
| 12 | typedef long BOOL; | 
|---|
| 13 |  | 
|---|
| 14 | #include "rectangle.h" | 
|---|
| 15 |  | 
|---|
| 16 | DDRectangle::DDRectangle ( Coord y1, | 
|---|
| 17 | Coord x1, | 
|---|
| 18 | Coord y2, | 
|---|
| 19 | Coord x2 ) | 
|---|
| 20 | { | 
|---|
| 21 | lTop    = y1; | 
|---|
| 22 | lLeft   = x1; | 
|---|
| 23 | lBottom = y2; | 
|---|
| 24 | lRight  = x2; | 
|---|
| 25 | pMemPtr = 0; | 
|---|
| 26 | } | 
|---|
| 27 |  | 
|---|
| 28 | BOOL DDRectangle::operator == ( const DDRectangle &aRect ) const | 
|---|
| 29 | { | 
|---|
| 30 | return ( lTop == aRect.lTop && lLeft == aRect.lLeft | 
|---|
| 31 | && | 
|---|
| 32 | lBottom == aRect.lBottom && lRight == aRect.lRight); | 
|---|
| 33 | } | 
|---|
| 34 | BOOL DDRectangle::operator != ( const DDRectangle& aRect ) const | 
|---|
| 35 | { | 
|---|
| 36 | return !( *this == aRect ); | 
|---|
| 37 | } | 
|---|
| 38 | BOOL DDRectangle::intersects ( const DDRectangle &aRect ) const | 
|---|
| 39 | { | 
|---|
| 40 | return ( lTop < aRect.lBottom && lLeft<aRect.lRight | 
|---|
| 41 | && | 
|---|
| 42 | aRect.lTop < lBottom && aRect.lLeft < lRight ); | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|
| 45 | DDRectangle::Coord DDRectangle::width (  ) const | 
|---|
| 46 | { | 
|---|
| 47 | return ( lRight - lLeft); | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | DDRectangle::Coord DDRectangle::height (  ) const | 
|---|
| 51 | { | 
|---|
| 52 | return ( lBottom - lTop); | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | DDRectangle::Coord DDRectangle::Top() const | 
|---|
| 56 | { | 
|---|
| 57 | return lTop; | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | DDRectangle::Coord DDRectangle::Left() const | 
|---|
| 61 | { | 
|---|
| 62 | return lLeft; | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 | DDRectangle::Coord DDRectangle::Bottom() const | 
|---|
| 66 | { | 
|---|
| 67 | return lBottom; | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | DDRectangle::Coord DDRectangle::Right() const | 
|---|
| 71 | { | 
|---|
| 72 | return lRight; | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 | void DDRectangle::SetMemPtr(void* NewMemPtr) | 
|---|
| 76 | { | 
|---|
| 77 | pMemPtr = NewMemPtr; | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | void* DDRectangle::GetMemPtr() | 
|---|
| 81 | { | 
|---|
| 82 | return pMemPtr; | 
|---|
| 83 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.