bool isThisInside(ref iRectangle2D otherPoint) { iPoint2D br1 = getBottomRight(); iPoint2D br2 = otherPoint.getBottomRight(); return(pos.x >= otherPoint.pos.x && pos.y >= otherPoint.pos.y && br1.x <= br2.x && br1.y <= br2.y); }
iRectangle2D getOverlap(ref iRectangle2D other) { iRectangle2D overlap = new iRectangle2D(); iPoint2D br1 = getBottomRight(); iPoint2D br2 = other.getBottomRight(); overlap.setAbsolute(Math.Max(pos.x, other.pos.x), Math.Max(pos.y, other.pos.y), Math.Min(br1.x, br2.x), Math.Min(br1.y, br2.y)); return(overlap); }
iRectangle2D combine(ref iRectangle2D other) { iRectangle2D combined = new iRectangle2D(); iPoint2D br1 = getBottomRight(); iPoint2D br2 = other.getBottomRight(); combined.setAbsolute(Math.Min(pos.x, other.pos.x), Math.Min(pos.y, other.pos.y), Math.Max(br1.x, br2.x), Math.Max(br2.y, br2.y)); return(combined); }
RawImage create(iPoint2D dim, RawImageType type, UInt32 componentsPerPixel) { switch (type) { case TYPE_USHORT16: return new RawImageDataU16(dim, componentsPerPixel); default: Debug.Write("RawImage::create: Unknown Image type!\n"); break; } return null; }
public RawImageData(iPoint2D _dim, UInt32 _bpc, UInt32 _cpp) { dim = (_dim); isCFA = (_cpp == 1); cfa = (new iPoint2D(0, 0)); blackLevel = (-1); whitePoint = (65536); cpp = (_cpp); bpp = (_bpc * _cpp); blackLevelSeparate[0] = blackLevelSeparate[1] = blackLevelSeparate[2] = blackLevelSeparate[3] = -1; mBadPixelMap = null; mDitherScale = true; createData(); pthread_mutex_init(&mymutex, null); pthread_mutex_init(&errMutex, null); pthread_mutex_init(&mBadPixelMutex, null); }
public RawImageData() { dim = new iPoint2D(0, 0); isCFA = (true); cfa = (new iPoint2D(0, 0)); blackLevel = (-1); whitePoint = (65536); blackLevelSeparate[0] = blackLevelSeparate[1] = blackLevelSeparate[2] = blackLevelSeparate[3] = -1; pthread_mutex_init(&mymutex, null); mBadPixelMap = null; pthread_mutex_init(&errMutex, null); pthread_mutex_init(&mBadPixelMutex, null); mDitherScale = true; }
/* This will make sure that offset is positive, and make the area smaller if needed */ /* This will return true if there is any area left */ bool cropOffsetToZero() { iPoint2D crop_pixels = new iPoint2D(); if (pos.x < 0) { crop_pixels.x = -(pos.x); pos.x = 0; } if (pos.y < 0) { crop_pixels.y = -pos.y; pos.y = 0; } dim -= crop_pixels; return(cropArea()); }
/* Set BR */ void setBottomRightAbsolute(iPoint2D bottom_right) { dim = new iPoint2D(bottom_right) - pos; }
void offset(iPoint2D offset) { pos += offset; }
iRectangle2D(iPoint2D _pos, iPoint2D size) { dim = size; pos = _pos; }
iRectangle2D(iRectangle2D r) { dim = new iPoint2D(r.dim); pos = new iPoint2D(r.pos); }
iRectangle2D(int x_pos, int y_pos, int w, int h) { dim = new iPoint2D(w, h); pos = new iPoint2D(x_pos, y_pos); }
iRectangle2D(int w, int h) { dim = new iPoint2D(w, h); }
public iPoint2D getSmallest(iPoint2D otherPoint) { return(new iPoint2D(Math.Min(x, otherPoint.x), Math.Min(y, otherPoint.y))); }
/* Retains size */ void setTopLeft(iPoint2D top_left) { pos = top_left; }
public iPoint2D(iPoint2D pt) { x = pt.x; y = pt.y; }
void setSize(iPoint2D size) { dim = size; }
void setAbsolute(iPoint2D top_left, iPoint2D bottom_right) { pos = top_left; setBottomRightAbsolute(bottom_right); }
void setAbsolute(int x1, int y1, int x2, int y2) { pos = new iPoint2D(x1, y1); dim = new iPoint2D(x2 - x1, y2 - y1); }
public bool isThisInside(iPoint2D otherPoint) { return(x <= otherPoint.x && y <= otherPoint.y); }
bool isPointInside(iPoint2D checkPoint) { iPoint2D br1 = getBottomRight(); return(pos.x <= checkPoint.x && pos.y <= checkPoint.y && br1.x >= checkPoint.x && br1.y >= checkPoint.y); }