IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4938


Ignore:
Timestamp:
Aug 31, 2005, 3:05:41 PM (21 years ago)
Author:
drobbin
Message:

made requested changes to ImageKeep(Mask)Circle(Region) functions - (char *op)

Location:
trunk/psLib/src/imageops
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelManip.c

    r4934 r4938  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-08-31 21:58:22 $
     12 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-09-01 01:05:41 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    400400void psImageMaskRegion(psImage *image,
    401401                       psRegion *region,
    402                        bool logical_and,
     402                       const char *op,
    403403                       psMaskType maskValue)
    404404{
     
    414414            if (iy + image->row0 >= region->y1)
    415415                continue;
    416             if (logical_and) {
     416            if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
    417417                image->data.U8[iy][ix] &= maskValue;
    418             } else {
     418            } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
    419419                image->data.U8[iy][ix] |= maskValue;
     420            } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
     421                image->data.U8[iy][ix] = maskValue;
     422            } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
     423                image->data.U8[iy][ix] ^= maskValue;
    420424            }
    421425        }
     
    427431void psImageKeepRegion(psImage *image,
    428432                       psRegion *region,
    429                        bool logical_and,
     433                       const char *op,
    430434                       psMaskType maskValue)
    431435{
     
    443447            continue;
    444448maskit:
    445             if (logical_and) {
     449            if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
    446450                image->data.U8[iy][ix] &= maskValue;
    447             } else {
     451            } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
    448452                image->data.U8[iy][ix] |= maskValue;
     453            } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
     454                image->data.U8[iy][ix] = maskValue;
     455            } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
     456                image->data.U8[iy][ix] ^= maskValue;
    449457            }
    450458        }
     
    458466                       double y,
    459467                       double radius,
    460                        bool logical_and,
     468                       const char *op,
    461469                       psMaskType maskValue)
    462470{
     
    473481            if (r2 > R2)
    474482                continue;
    475             if (logical_and) {
     483            if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
    476484                image->data.U8[iy][ix] &= maskValue;
    477             } else {
     485            } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
    478486                image->data.U8[iy][ix] |= maskValue;
     487            } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
     488                image->data.U8[iy][ix] = maskValue;
     489            } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
     490                image->data.U8[iy][ix] ^= maskValue;
    479491            }
    480492        }
     
    488500                       double y,
    489501                       double radius,
    490                        bool logical_and,
     502                       const char *op,
    491503                       psMaskType maskValue)
    492504{
     
    503515            if (r2 < R2)
    504516                continue;
    505             if (logical_and) {
     517            if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
    506518                image->data.U8[iy][ix] &= maskValue;
    507             } else {
     519            } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
    508520                image->data.U8[iy][ix] |= maskValue;
     521            } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
     522                image->data.U8[iy][ix] = maskValue;
     523            } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
     524                image->data.U8[iy][ix] ^= maskValue;
    509525            }
    510526        }
  • trunk/psLib/src/imageops/psImagePixelManip.h

    r4934 r4938  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-08-31 21:58:22 $
     10 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-09-01 01:05:41 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9595    psImage *image,                    ///< the image to set
    9696    psRegion *region,                  ///< the specified region
    97     bool logical_and,                  ///< the logical operation
     97    const char *op,                    ///< the logical operation
    9898    psMaskType maskValue               ///< the specified bits
    9999);
     
    107107    psImage *image,                    ///< the image to set
    108108    psRegion *region,                  ///< the specified region
    109     bool logical_and,                  ///< the logical operation
     109    const char *op,                    ///< the logical operation
    110110    psMaskType maskValue               ///< the specified bits
    111111);
     
    121121    double y,                          ///< the y coordinate of the circle's center
    122122    double radius,                     ///< the radius of the specified circle
    123     bool logical_and,                  ///< the logical operation
     123    const char *op,                    ///< the logical operation
    124124    psMaskType maskValue               ///< the specified bits
    125125);
     
    135135    double y,                          ///< the y coordinate of the circle's center
    136136    double radius,                     ///< the radius of the specified circle
    137     bool logical_and,                  ///< the logical operation
     137    const char *op,                    ///< the logical operation
    138138    psMaskType maskValue               ///< the specified bits
    139139);
Note: See TracChangeset for help on using the changeset viewer.