diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-10-20 20:00:59 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-10-20 20:00:59 (GMT) |
commit | f69c177fa06a6f3537818ea44d78caafd6cdeb64 (patch) | |
tree | b2b4f5626ec6d73884fa91dfccb99210b0ac2188 | |
parent | 0352ad82c2c4a26fbfedab0cd997b85f3b93e50c (diff) | |
download | blt-f69c177fa06a6f3537818ea44d78caafd6cdeb64.zip blt-f69c177fa06a6f3537818ea44d78caafd6cdeb64.tar.gz blt-f69c177fa06a6f3537818ea44d78caafd6cdeb64.tar.bz2 |
new mask
-rw-r--r-- | tksao/frame/base.C | 59 | ||||
-rw-r--r-- | tksao/frame/base.h | 13 | ||||
-rw-r--r-- | tksao/frame/fitsmask.C | 26 | ||||
-rw-r--r-- | tksao/frame/fitsmask.h | 17 | ||||
-rw-r--r-- | tksao/frame/frame.C | 65 | ||||
-rw-r--r-- | tksao/frame/frame.h | 3 | ||||
-rw-r--r-- | tksao/frame/frame3d.C | 21 | ||||
-rw-r--r-- | tksao/frame/framergb.C | 26 |
8 files changed, 174 insertions, 56 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 766bbe6..e6ad19e 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -1136,6 +1136,64 @@ Matrix Base::psMatrix(float scale, int width, int height) return refToUser * userToPS; } +// waj + +void Base::pushMatrices(FitsImage* fits, Matrix& rgbToRef) +{ + FitsImage* ptr = fits; + while (ptr) { + FitsImage* sptr = ptr; + while (sptr) { + sptr->updateMatrices(rgbToRef, refToUser, userToWidget, + widgetToCanvas, canvasToWindow); + sptr = sptr->nextSlice(); + } + ptr = ptr->nextMosaic(); + } +} + +void Base::pushMagnifierMatrices(FitsImage* fits) +{ + FitsImage* ptr = fits; + while (ptr) { + FitsImage* sptr = ptr; + while (sptr) { + sptr->updateMagnifierMatrices(refToMagnifier); + sptr = sptr->nextSlice(); + } + ptr = ptr->nextMosaic(); + } +} + +void Base::pushPannerMatrices(FitsImage* fits) +{ + FitsImage* ptr = fits; + while (ptr) { + FitsImage* sptr = ptr; + while (sptr) { + sptr->updatePannerMatrices(refToPanner); + sptr = sptr->nextSlice(); + } + ptr = ptr->nextMosaic(); + } +} + +void Base::pushPSMatrices(FitsImage* fits, float scale, int width, int height) +{ + Matrix mx = psMatrix(scale, width, height); + + FitsImage* ptr = fits; + while (ptr) { + FitsImage* sptr = ptr; + while (sptr) { + sptr->updatePS(mx); + sptr = sptr->nextSlice(); + } + ptr = ptr->nextMosaic(); + } +} + +/* void Base::pushMatrices() { Matrix rgbToRef; @@ -1192,6 +1250,7 @@ void Base::pushPSMatrices(float scale, int width, int height) ptr = ptr->nextMosaic(); } } +*/ void Base::reset() { diff --git a/tksao/frame/base.h b/tksao/frame/base.h index 04e3bc1..400103e 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -440,11 +440,22 @@ public: void psImage(ostream&, Filter&, int, int, float); void psMarkers(List<Marker>*, int); Matrix psMatrix(float scale, int width, int height); + void pushMatrices(FitsImage*, Matrix&); + void pushMagnifierMatrices(FitsImage*); + void pushPannerMatrices(FitsImage*); + void pushPSMatrices(FitsImage*, float, int, int); + // waj + virtual void pushMatrices() =0; + virtual void pushMagnifierMatrices() =0; + virtual void pushPannerMatrices() =0; + virtual void pushPSMatrices(float, int, int) =0; + /* virtual void pushMatrices(); virtual void pushMagnifierMatrices(); virtual void pushPannerMatrices(); virtual void pushPSMatrices(float, int, int); - + */ + virtual void reset(); void resetSecMode(); diff --git a/tksao/frame/fitsmask.C b/tksao/frame/fitsmask.C index 1eae29b..50cadc6 100644 --- a/tksao/frame/fitsmask.C +++ b/tksao/frame/fitsmask.C @@ -8,11 +8,9 @@ #include "base.h" #include "fitsimage.h" -FitsMask::FitsMask(Base* p, FitsImage* fits, char* clr, int mrk) - : parent_(p), mask_(fits) +FitsMask::FitsMask(Base* pp, Context* cc, char* clr, int mrk) + : parent_(pp), context_(cc) { - current_ = mask_; - mptr_ = current_; colorName_ = dupstr(clr); color_ = parent_->getXColor(colorName_); parent_->encodeTrueColor(color_, trueColor_); @@ -26,25 +24,5 @@ FitsMask::~FitsMask() { if (colorName_) delete [] colorName_; - - FitsImage* ptr = mask_; - while (ptr) { - // better not have more that one slice - FitsImage* sptr = ptr->nextSlice(); - while (sptr) { - FitsImage* stmp = sptr->nextSlice(); - delete sptr; - sptr = stmp; - } - - FitsImage* tmp = ptr->nextMosaic(); - delete ptr; - ptr = tmp; - } -} - -void FitsMask::nextMosaic() { - if (mptr_) - mptr_ = mptr_->nextMosaic(); } diff --git a/tksao/frame/fitsmask.h b/tksao/frame/fitsmask.h index c9ee388..5c41cae 100644 --- a/tksao/frame/fitsmask.h +++ b/tksao/frame/fitsmask.h @@ -8,15 +8,12 @@ #include "util.h" class Base; -class FitsImage; +class Context; class FitsMask { private: Base* parent_; - - FitsImage* mask_; - FitsImage* current_; - FitsImage* mptr_; + Context* context_; char* colorName_; XColor* color_; @@ -29,20 +26,14 @@ class FitsMask { FitsMask* next_; public: - FitsMask(Base*, FitsImage*, char*, int); + FitsMask(Base*, Context*, char*, int); virtual ~FitsMask(); - FitsImage* mask() {return mask_;} - FitsImage* current() {return current_;} - FitsImage* mptr() {return mptr_;} + Context* context() {return context_;} XColor* color() {return color_;} char* trueColor() {return trueColor_;} int mark() {return mark_;} - void initMosaic() {mptr_ = current_;} - void nextMosaic(); - void nextSlice(); - FitsMask* previous() {return previous_;} void setPrevious(FitsMask* m) {previous_ = m;} FitsMask* next() {return next_;} diff --git a/tksao/frame/frame.C b/tksao/frame/frame.C index ce69756..20a9185 100644 --- a/tksao/frame/frame.C +++ b/tksao/frame/frame.C @@ -281,6 +281,58 @@ int Frame::isIIS() return context->cfits && context->cfits->isIIS(); } +// waj +void Frame::pushMatrices() +{ + // alway identity + Matrix rgbToRef; + Base::pushMatrices(keyContext->fits, rgbToRef); + + // now any masks + FitsMask* msk = mask.tail(); + while (msk) { + Base::pushMatrices(msk->context()->fits, rgbToRef); + msk = msk->previous(); + } +} + +void Frame::pushMagnifierMatrices() +{ + Base::pushMagnifierMatrices(keyContext->fits); + + // now any masks + FitsMask* msk = mask.tail(); + while (msk) { + Base::pushMagnifierMatrices(msk->context()->fits); + msk = msk->previous(); + } +} + +void Frame::pushPannerMatrices() +{ + Base::pushPannerMatrices(keyContext->fits); + + // now any masks + FitsMask* msk = mask.tail(); + while (msk) { + Base::pushPannerMatrices(msk->context()->fits); + msk = msk->previous(); + } +} + +void Frame::pushPSMatrices(float scale, int width, int height) +{ + Base::pushPSMatrices(keyContext->fits, scale, width, height); + + // now any masks + FitsMask* msk = mask.tail(); + while (msk) { + Base::pushPSMatrices(msk->context()->fits, scale, width, height); + msk = msk->previous(); + } +} + +/* void Frame::pushMatrices() { Base::pushMatrices(); @@ -288,8 +340,6 @@ void Frame::pushMatrices() // alway identity Matrix rgbToRef; - // waj - /* // now any masks FitsMask* msk = currentContext->mask.tail(); while (msk) { @@ -306,15 +356,12 @@ void Frame::pushMatrices() msk = msk->previous(); } - */ } void Frame::pushMagnifierMatrices() { Base::pushMagnifierMatrices(); - // waj - /* FitsMask* msk = context->mask.tail(); while (msk) { FitsImage* mskimg = msk->mask(); @@ -328,15 +375,12 @@ void Frame::pushMagnifierMatrices() } msk = msk->previous(); } - */ } void Frame::pushPannerMatrices() { Base::pushPannerMatrices(); - // waj - /* FitsMask* msk = context->mask.tail(); while (msk) { FitsImage* mskimg = msk->mask(); @@ -350,15 +394,12 @@ void Frame::pushPannerMatrices() } msk = msk->previous(); } - */ } void Frame::pushPSMatrices(float scale, int width, int height) { Base::pushPSMatrices(scale, width, height); - // waj - /* Matrix mx = psMatrix(scale, width, height); FitsMask* msk = context->mask.tail(); while (msk) { @@ -369,8 +410,8 @@ void Frame::pushPSMatrices(float scale, int width, int height) } msk = msk->previous(); } - */ } +*/ void Frame::reset() { diff --git a/tksao/frame/frame.h b/tksao/frame/frame.h index c6af322..f89a9d3 100644 --- a/tksao/frame/frame.h +++ b/tksao/frame/frame.h @@ -6,6 +6,7 @@ #define __frame_h__ #include "context.h" +#include "fitsmask.h" #include "framebase.h" #include "colorscale.h" @@ -23,7 +24,7 @@ class Frame : public FrameBase { ColorScale* colorScale; // current color scale unsigned char* colorCells; // current color values - // List <FitsMask> mask; + List <FitsMask> mask; private: unsigned char* blend(unsigned char*, unsigned char*, int, int); diff --git a/tksao/frame/frame3d.C b/tksao/frame/frame3d.C index 9983475..7fef84f 100644 --- a/tksao/frame/frame3d.C +++ b/tksao/frame/frame3d.C @@ -987,13 +987,18 @@ void Frame3d::updateColorCells(unsigned char* cells, int cnt) void Frame3d::pushMatrices() { - Base::pushMatrices(); + // waj + // alway identity + Matrix rgbToRef; + Base::pushMatrices(keyContext->fits, rgbToRef); + // Base::pushMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { FitsImage* sptr = ptr; while (sptr) { - sptr->updateMatrices(refToUser3d, userToWidget3d, widgetToCanvas3d, canvasToWindow3d); + sptr->updateMatrices(refToUser3d, userToWidget3d, widgetToCanvas3d, + canvasToWindow3d); sptr = sptr->nextSlice(); } ptr = ptr->nextMosaic(); @@ -1002,7 +1007,9 @@ void Frame3d::pushMatrices() void Frame3d::pushPannerMatrices() { - Base::pushPannerMatrices(); + // waj + Base::pushPannerMatrices(keyContext->fits); + // Base::pushPannerMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { @@ -1017,7 +1024,9 @@ void Frame3d::pushPannerMatrices() void Frame3d::pushMagnifierMatrices() { - Base::pushMagnifierMatrices(); + // waj + Base::pushMagnifierMatrices(keyContext->fits); + // Base::pushMagnifierMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { @@ -1032,7 +1041,9 @@ void Frame3d::pushMagnifierMatrices() void Frame3d::pushPSMatrices(float scale, int width, int height) { - Base::pushPSMatrices(scale, width, height); + // waj + Base::pushPSMatrices(keyContext->fits, scale, width, height); + // Base::pushPSMatrices(scale, width, height); Matrix3d mx = psMatrix(scale, width, height); FitsImage* ptr = keyContext->fits; diff --git a/tksao/frame/framergb.C b/tksao/frame/framergb.C index 4cadf22..89942c3 100644 --- a/tksao/frame/framergb.C +++ b/tksao/frame/framergb.C @@ -659,6 +659,31 @@ void FrameRGB::loadRGBFinish() update(MATRIX); } +// waj +void FrameRGB::pushMatrices() +{ + for (int ii=0; ii<3; ii++) + Base::pushMatrices(context[ii].fits, rgb[ii]); +} + +void FrameRGB::pushMagnifierMatrices() +{ + for (int ii=0; ii<3; ii++) + Base::pushMagnifierMatrices(context[ii].fits); +} + +void FrameRGB::pushPannerMatrices() +{ + for (int ii=0; ii<3; ii++) + Base::pushPannerMatrices(context[ii].fits); +} + +void FrameRGB::pushPSMatrices(float scale, int width, int height) +{ + for (int ii=0; ii<3; ii++) + Base::pushPSMatrices(context[ii].fits, scale, width, height); +} +/* void FrameRGB::pushMatrices() { for (int ii=0; ii<3; ii++) { @@ -717,6 +742,7 @@ void FrameRGB::pushPSMatrices(float scale, int width, int height) } } } +*/ void FrameRGB::reset() { |