summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-10-25 17:55:15 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-10-25 17:55:15 (GMT)
commitd6a9796a1e17a05da7c3d5d73848527def777936 (patch)
tree136dfa13a160782e6a0d8c3c0367867ada57766a /tksao
parent9eb8b30aebbb4d61f521f36e9ba7b1f182cd1740 (diff)
downloadblt-d6a9796a1e17a05da7c3d5d73848527def777936.zip
blt-d6a9796a1e17a05da7c3d5d73848527def777936.tar.gz
blt-d6a9796a1e17a05da7c3d5d73848527def777936.tar.bz2
clean up frame code
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/base.C12
-rw-r--r--tksao/frame/base.h2
-rw-r--r--tksao/frame/frame.C33
-rw-r--r--tksao/frame/frame3d.C16
-rw-r--r--tksao/frame/frame3dbase.C4
-rw-r--r--tksao/frame/framergb.C34
6 files changed, 51 insertions, 50 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C
index 0aa2ef9..1c6b549 100644
--- a/tksao/frame/base.C
+++ b/tksao/frame/base.C
@@ -300,13 +300,17 @@ void Base::alignWCS(FitsImage* ptr, Coord::CoordSystem sys)
Vector(mm[0][1],mm[1][1]).length())/2.;
}
-XColor* Base::bgColor()
+XColor* Base::getBGColor()
{
#ifndef MAC_OSX_TK
return getXColor(bgColourName);
#else
- return !strncmp(bgColourName,"white",5) ?
- options->bgColor : getXColor(bgColourName);
+ // return !strncmp(bgColourName,"white",5) ?
+ // options->bgColor : getXColor(bgColourName);
+ if (!strncmp(bgColourName,"white",5))
+ return getXColor("systemTextBackgroundColor");
+ else
+ return getXColor(bgColourName);
#endif
}
@@ -1319,7 +1323,7 @@ void Base::updateBase()
if (doRender())
ximageToPixmap(basePixmap, baseXImage, Coord::WIDGET);
else {
- XSetForeground(display, widgetGC, bgColor()->pixel);
+ XSetForeground(display, widgetGC, getBGColor()->pixel);
XFillRectangle(display, basePixmap, widgetGC, 0, 0,
options->width,options->height);
}
diff --git a/tksao/frame/base.h b/tksao/frame/base.h
index 86ad5a3..a84498f 100644
--- a/tksao/frame/base.h
+++ b/tksao/frame/base.h
@@ -313,7 +313,7 @@ public:
virtual void alignWCS(Coord::CoordSystem, Coord::SkyFrame);
virtual void alignWCS(FitsImage*, Coord::CoordSystem);
- XColor* bgColor();
+ XColor* getBGColor();
void bltCut(char*, char*, Coord::Orientation, const Vector&,
int, Base::CutMethod);
diff --git a/tksao/frame/frame.C b/tksao/frame/frame.C
index 4145258..1067e32 100644
--- a/tksao/frame/frame.C
+++ b/tksao/frame/frame.C
@@ -93,18 +93,17 @@ unsigned char* Frame::blend(unsigned char* src, unsigned char* msk,
unsigned char* Frame::fillImage(int width, int height,
Coord::InternalSystem sys)
{
- XColor* bgColour = bgColor();
- XColor* nanColour = getXColor(nanColourName);
-
// img
+ XColor* bgColor = getBGColor();
+ XColor* nanColor = getXColor(nanColourName);
unsigned char* img = new unsigned char[width*height*3];
{
unsigned char* ptr = img;
for (int jj=0; jj<height; jj++)
for (int ii=0; ii<width; ii++) {
- *ptr++ = (unsigned char)bgColour->red;
- *ptr++ = (unsigned char)bgColour->green;
- *ptr++ = (unsigned char)bgColour->blue;
+ *ptr++ = (unsigned char)bgColor->red;
+ *ptr++ = (unsigned char)bgColor->green;
+ *ptr++ = (unsigned char)bgColor->blue;
}
}
@@ -172,9 +171,9 @@ unsigned char* Frame::fillImage(int width, int height,
}
}
else {
- *(dest+2) = nanColour->blue;
- *(dest+1) = nanColour->green;
- *dest = nanColour->red;
+ *(dest+2) = nanColor->blue;
+ *(dest+1) = nanColor->green;
+ *dest = nanColor->red;
}
break;
@@ -710,13 +709,13 @@ void Frame::colormapMotionCmd(int id, float b, float c, int i,
if (!context->cfits)
return;
- XColor* bgColour = bgColor();
+ XColor* bgColor = getBGColor();
char bgTrueColor[4]; // color encoded
- encodeTrueColor(bgColour, bgTrueColor);
+ encodeTrueColor(bgColor, bgTrueColor);
- XColor* nanColour = getXColor(nanColourName);
+ XColor* nanColor = getXColor(nanColourName);
char nanTrueColor[4]; // color encoded
- encodeTrueColor(nanColour, nanTrueColor);
+ encodeTrueColor(nanColor, nanTrueColor);
// clear ximage
int& width = colormapXM->width;
@@ -901,7 +900,7 @@ void Frame::savePhotoCmd(const char* ph)
int width = params->xmax - params->xmin;
int height = params->ymax - params->ymin;
- XColor* nanColour = getXColor(nanColourName);
+ XColor* nanColor = getXColor(nanColourName);
// photo
if (*ph == '\0') {
@@ -958,9 +957,9 @@ void Frame::savePhotoCmd(const char* ph)
}
}
else {
- *(dest+block.offset[0]) = nanColour->red;
- *(dest+block.offset[1]) = nanColour->green;
- *(dest+block.offset[2]) = nanColour->blue;
+ *(dest+block.offset[0]) = nanColor->red;
+ *(dest+block.offset[1]) = nanColor->green;
+ *(dest+block.offset[2]) = nanColor->blue;
*(dest+block.offset[3]) = 255;
}
}
diff --git a/tksao/frame/frame3d.C b/tksao/frame/frame3d.C
index 5ae2bbd..05a3ba3 100644
--- a/tksao/frame/frame3d.C
+++ b/tksao/frame/frame3d.C
@@ -824,7 +824,7 @@ unsigned char* Frame3d::fillImageColor(RayTrace* rt)
double hh = keyContext->fits->high();
double diff = hh - ll;
- XColor* bgColour = bgColor();
+ XColor* bgColor = getBGColor();
unsigned char* dest = img;
float* src = zbuf;
@@ -832,9 +832,9 @@ unsigned char* Frame3d::fillImageColor(RayTrace* rt)
for (int jj=0; jj<height; jj++) {
for (int ii=0; ii<width; ii++, dest+=3, src++, mksrc++) {
- *dest = (unsigned char)bgColour->red;
- *(dest+1) = (unsigned char)bgColour->green;
- *(dest+2) = (unsigned char)bgColour->blue;
+ *dest = (unsigned char)bgColor->red;
+ *(dest+1) = (unsigned char)bgColor->green;
+ *(dest+2) = (unsigned char)bgColor->blue;
// will not see nan
if (isfinite(diff)) {
@@ -1151,7 +1151,7 @@ void Frame3d::savePhotoCmd(const char* ph)
return;
}
- XColor* nanColour = getXColor(nanColourName);
+ XColor* nanColor = getXColor(nanColourName);
// main loop
SETSIGBUS
@@ -1182,9 +1182,9 @@ void Frame3d::savePhotoCmd(const char* ph)
}
}
else {
- *(dest+block.offset[0]) = nanColour->red;
- *(dest+block.offset[1]) = nanColour->green;
- *(dest+block.offset[2]) = nanColour->blue;
+ *(dest+block.offset[0]) = nanColor->red;
+ *(dest+block.offset[1]) = nanColor->green;
+ *(dest+block.offset[2]) = nanColor->blue;
*(dest+block.offset[3]) = 255;
}
}
diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C
index 8c18cb7..c279440 100644
--- a/tksao/frame/frame3dbase.C
+++ b/tksao/frame/frame3dbase.C
@@ -1175,9 +1175,9 @@ void Frame3dBase::ximageToPixmapMagnifier()
if (!basePixmap || !baseXImage || !magnifierPixmap || !magnifierXImage)
return;
- XColor* bgColour = bgColor();
+ XColor* bgColor = getBGColor();
char bgTrueColor[4]; // color encoded
- encodeTrueColor(bgColour, bgTrueColor);
+ encodeTrueColor(bgColor, bgTrueColor);
// magnifier
int& ww = magnifierXImage->width;
diff --git a/tksao/frame/framergb.C b/tksao/frame/framergb.C
index b87ef0c..abdcc61 100644
--- a/tksao/frame/framergb.C
+++ b/tksao/frame/framergb.C
@@ -132,9 +132,6 @@ unsigned char* FrameRGB::fillImage(int width, int height,
char* mk = new char[width*height];
memset(mk,0,width*height);
- XColor* bgColour = bgColor();
- XColor* nanColour = getXColor(nanColourName);
-
SETSIGBUS
// one channel at a time
@@ -221,6 +218,8 @@ unsigned char* FrameRGB::fillImage(int width, int height,
}
// now fill in bg
+ XColor* bgColor = getBGColor();
+ XColor* nanColor = getXColor(nanColourName);
{
unsigned char* dest = img;
char* mkptr = mk;
@@ -229,14 +228,14 @@ unsigned char* FrameRGB::fillImage(int width, int height,
if (*mkptr == 2) // good value
;
else if (*mkptr == 1) { // nan
- *dest = (unsigned char)nanColour->red;
- *(dest+1) = (unsigned char)nanColour->green;
- *(dest+2) = (unsigned char)nanColour->blue;
+ *dest = (unsigned char)nanColor->red;
+ *(dest+1) = (unsigned char)nanColor->green;
+ *(dest+2) = (unsigned char)nanColor->blue;
}
else { // bg
- *dest = (unsigned char)bgColour->red;
- *(dest+1) = (unsigned char)bgColour->green;
- *(dest+2) = (unsigned char)bgColour->blue;
+ *dest = (unsigned char)bgColor->red;
+ *(dest+1) = (unsigned char)bgColor->green;
+ *(dest+2) = (unsigned char)bgColor->blue;
}
}
}
@@ -669,9 +668,6 @@ void FrameRGB::colormapMotionCmd(float rb, float gb, float bb,
int& width = colormapXM->width;
int& height = colormapXM->height;
- XColor* bgColour = bgColor();
- XColor* nanColour = getXColor(nanColourName);
-
// create img
unsigned char* img = new unsigned char[width*height*3];
memset(img, 0, width*height*3);
@@ -697,6 +693,8 @@ void FrameRGB::colormapMotionCmd(float rb, float gb, float bb,
}
// set remainder to bg
+ XColor* bgColor = getBGColor();
+ XColor* nanColor = getXColor(nanColourName);
{
unsigned char* dest = img;
char* mptr = mk;
@@ -705,14 +703,14 @@ void FrameRGB::colormapMotionCmd(float rb, float gb, float bb,
if (*mptr == 2) // good value
;
else if (*mptr == 1) { // nan
- *(dest ) = (unsigned char)nanColour->red;
- *(dest+1) = (unsigned char)nanColour->green;
- *(dest+2) = (unsigned char)nanColour->blue;
+ *(dest ) = (unsigned char)nanColor->red;
+ *(dest+1) = (unsigned char)nanColor->green;
+ *(dest+2) = (unsigned char)nanColor->blue;
}
else { // bg
- *(dest ) = (unsigned char)bgColour->red;
- *(dest+1) = (unsigned char)bgColour->green;
- *(dest+2) = (unsigned char)bgColour->blue;
+ *(dest ) = (unsigned char)bgColor->red;
+ *(dest+1) = (unsigned char)bgColor->green;
+ *(dest+2) = (unsigned char)bgColor->blue;
}
}