Changeset 17 for trunk/libdjvu/GRect.h


Ignore:
Timestamp:
May 3, 2006, 10:14:37 AM (15 years ago)
Author:
Eugene Romanenko
Message:

update makefiles, remove absolute paths, update djvulibre to version 3.5.17

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libdjvu/GRect.h

    r15 r17  
    5252//C- +------------------------------------------------------------------
    5353//
    54 // $Id: GRect.h,v 1.9 2003/11/07 22:08:21 leonb Exp $
    55 // $Name: release_3_5_16 $
     54// $Id: GRect.h,v 1.11 2006/02/21 16:10:29 docbill Exp $
     55// $Name: $
    5656
    5757#ifndef _GRECT_H_
     
    7676    L\'eon Bottou <leonb@research.att.com> -- initial implementation.
    7777    @version
    78     #$Id: GRect.h,v 1.9 2003/11/07 22:08:21 leonb Exp $# */
     78    #$Id: GRect.h,v 1.11 2006/02/21 16:10:29 docbill Exp $# */
    7979//@{
    8080
     
    8888#endif
    8989
     90
     91/* Flag to indicate that this djvulibre version
     92   gets rid of all the crap about orientation bits.
     93   All rotation code has been fixed and consistently
     94   implements counter-clockwise rotations. */
     95
     96#define GRECT_WITHOUT_ORIENTATION_BITS 1
    9097
    9198
     
    133140{
    134141public:
    135   /** #OrientationBits# defines 3 mutually exclusive
    136      bits to indicate the image orientation.
    137 
    138      There are four possible rotation values for an image
    139      which are 0 degrees, 90 degrees, 180 degrees, and 270 degrees.
    140      In addition the image can be mirrored backwards in any of these
    141      orientations, giving a possible of 8 orientations.  To sanely deal
    142      with these orientations, we have defined 3 mutually exclusive
    143      bits.  These are BOTTOM_UP, MIRROR, and ROTATE90_CW.
    144   */
    145   enum OrientationBits
    146   {
    147     BOTTOM_UP=0x1,  /* Upside down */
    148     MIRROR=0x2,     /* Written backwards. (right to left) */
    149     ROTATE90_CW=0x4 /* rotated 90 degrees */
    150   };
    151 
    152   /**  #Orientations# defines all 8 possible orientations, using
    153    the three \Ref{OrientationBits}.
    154    \begin{itemize}
    155    \item {\em TDLRNR} for Top Down, Left to Right, No Rotation.
    156    \item {\em BULRNR} for Bottom Up, Left to Right, No Rotation.
    157    \item {\em TDRLNR} for Top Down, Right to Left, No Rotation.
    158    \item {\em BURLNR} for Bottom Up, Right to Left, No Rotation.
    159    \item {\em TDLRCW} for Top Down, Left to Right, 90 degree CW rotation.
    160    \item {\em BULRCW} for Bottom Up, Left to Right, 90 degree CW rotation.
    161    \item {\em TDRLCW} for Top Down, Right to Left, 90 degree CW rotation.
    162    \item {\em BURLCW} for Bottom Up, Right to Left, 90 degree CW rotation.
    163    \end{itemize}
    164   */
    165   enum Orientations
    166   {
    167     TDLRNR=0,                                     /* normal orientation */
    168     BULRNR=BOTTOM_UP,                               /* upside down */
    169     TDRLNR=MIRROR,                    /* backwards (right to left) */
    170     BURLNR=MIRROR|BOTTOM_UP,                    /* rotate 180 */
    171     TDLRCW=ROTATE90_CW,                              /* rotated 90 */
    172     BULRCW=ROTATE90_CW|BOTTOM_UP, /* backwards and rotate 180 */
    173     TDRLCW=ROTATE90_CW|MIRROR,     /* backwards and rotate 90 */
    174     BURLCW=ROTATE90_CW|MIRROR|BOTTOM_UP    /* rotate 270 */
    175   };
    176 
    177   static Orientations
    178   rotate(const int angle,Orientations orientation)
    179   {
    180     for(int a=(((angle)%360)+405)%360;a>90;a-=90)
    181       orientation=(Orientations)((int)orientation^(int)(orientation&ROTATE90_CW)?BURLCW:TDLRCW);
    182     return orientation;
    183   }
    184 
    185   static int
    186   findangle(const Orientations orientation)
    187   {
    188     int a=270;
    189     while(a&&(rotate(a,BURLNR)!=orientation)&&(rotate(a,TDRLNR)!=orientation))
    190       a-=90;
    191     return a;
    192   }
    193 
    194142  /** Constructs an empty rectangle */
    195143  GRect();
     
    205153  int  area() const;
    206154  /** Returns true if the rectangle is empty. */
    207   int  isempty() const;
     155  bool  isempty() const;
    208156  /** Returns true if the rectangle contains pixel (#x#,#y#).  A rectangle
    209157      contains all pixels with horizontal pixel coordinates in range #xmin#
     
    316264      overwritten with the new rectangle coordinates. */
    317265  void unmap(GRect &rect);
    318 private:
     266public:
    319267  // GRatio
    320268  struct GRatio {
     
    324272    int q;
    325273  };
     274private:
    326275  // Data
    327276  GRect rectFrom;
     
    367316}
    368317
    369 inline int
     318inline bool
    370319GRect::isempty() const
    371320{
Note: See TracChangeset for help on using the changeset viewer.