Changeset 37807 for trunk/Ohana/src/kapa2
- Timestamp:
- Jan 11, 2015, 2:14:39 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 13 edited
-
. (modified) (1 prop)
-
src/kapa2/include/constants.h (modified) (1 diff)
-
src/kapa2/include/structures.h (modified) (1 diff)
-
src/kapa2/src/CreatePicture.c (modified) (1 diff)
-
src/kapa2/src/CursorOps.c (modified) (2 diffs)
-
src/kapa2/src/Graphs.c (modified) (1 diff)
-
src/kapa2/src/Image.c (modified) (2 diffs)
-
src/kapa2/src/InterpretKeys.c (modified) (1 diff)
-
src/kapa2/src/LoadPicture.c (modified) (1 diff)
-
src/kapa2/src/Reconfig.c (modified) (1 diff)
-
src/kapa2/src/Remap32.c (modified) (6 diffs)
-
src/kapa2/src/SetChannel.c (modified) (2 diffs)
-
src/kapa2/src/UpdateStatusBox.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
-
trunk/Ohana/src/kapa2/include/constants.h
r36084 r37807 10 10 | PointerMotionMask) 11 11 12 # define NCHANNELS 312 # define NCHANNELS 10 13 13 # define NPIXELS_DYNAMIC 128 14 14 -
trunk/Ohana/src/kapa2/include/structures.h
r32695 r37807 217 217 KapaImageChannel *image; 218 218 KapaImageChannel channel[NCHANNELS]; 219 int currentChannel; 219 220 } KapaImageWidget; 220 221 -
trunk/Ohana/src/kapa2/src/CreatePicture.c
r16270 r37807 40 40 41 41 case 24: 42 43 extra = 4 - (image[0].wide.dx * 3) % 4; 44 REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra)); 45 46 extra = 4 - (image[0].zoom.dx * 3) % 4; 47 REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra)); 48 42 49 extra = 4 - (image[0].picture.dx * 3) % 4; 43 REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra));44 REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra));45 50 REALLOCATE (image[0].picture.data, char, image[0].picture.dy*(3*image[0].picture.dx+extra)); 46 51 c = (unsigned char *) image[0].picture.data; -
trunk/Ohana/src/kapa2/src/CursorOps.c
r25757 r37807 100 100 // Sx, Sy are the screen coordinates of the Ix,Iy pixel 101 101 Image_to_Picture (&Sx, &Sy, Ix, Iy, picture); 102 103 // Sx,Sy should be forced into the pixel 104 int Sxi = Sx + 0.5; 105 int Syi = Sy + 0.5; 102 106 103 107 // i_start, j_start are now limited to valid screen coordinates 104 *i_start = MIN (MAX (Sx , 0), picture[0].dx);105 *j_start = MIN (MAX (Sy , 0), picture[0].dy);108 *i_start = MIN (MAX (Sxi, 0), picture[0].dx); 109 *j_start = MIN (MAX (Syi, 0), picture[0].dy); 106 110 } 107 111 … … 127 131 Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]); 128 132 129 // I_end, J_end are the last displayed image pixel130 // *I_end = Ix;131 // *J_end = Iy;132 133 133 // Sx, Sy are the screen coordinates of the Ix,Iy pixel 134 134 Image_to_Picture (&Sx, &Sy, Ix, Iy, picture); 135 135 136 // Sx,Sy should be forced into the pixel 137 int Sxi = Sx + 0.5; 138 int Syi = Sy + 0.5; 139 140 // double IxTest, IyTest; 141 // Picture_to_Image (&IxTest, &IyTest, Sx, Sy, picture); 142 // fprintf (stderr, "dx,dy: %d,%d : %f,%f : %f,%f : %f:%f\n", picture[0].dx, picture[0].dy, Ix, Iy, Sx, Sy, IxTest, IyTest); 143 136 144 // i_start, j_start are now limited to valid screen coordinates 137 *i_end = MIN (MAX (Sx, 0), picture[0].dx); 138 *j_end = MIN (MAX (Sy, 0), picture[0].dy); 145 // XXX: i_end, j_end *should* be the last valid screen pixel plus 1 146 *i_end = MIN (MAX (Sxi, 0), picture[0].dx); 147 *j_end = MIN (MAX (Syi, 0), picture[0].dy); 139 148 140 149 // round off error can leave us with a small number of extra pixels here. -
trunk/Ohana/src/kapa2/src/Graphs.c
r36487 r37807 57 57 graph[0].data.flipnorth = FALSE; // +North = +Y by default 58 58 59 graph[0].data.coords.pc1_1 = graph[0].data.coords.pc2_2 = 1.0; 60 graph[0].data.coords.pc1_2 = graph[0].data.coords.pc2_1 = 0.0; 61 graph[0].data.coords.crval1 = 0.0; 62 graph[0].data.coords.crval2 = 0.0; 63 graph[0].data.coords.crpix1 = 0.0; 64 graph[0].data.coords.crpix2 = 0.0; 65 graph[0].data.coords.cdelt1 = graph[0].data.coords.cdelt2 = 1.0; 66 strcpy (graph[0].data.coords.ctype, "DEC--LIN"); 59 InitCoords (&graph[0].data.coords, "DEC--LIN"); 67 60 strcpy (graph[0].data.axis, "2222"); 68 61 strcpy (graph[0].data.ticks, "2222"); -
trunk/Ohana/src/kapa2/src/Image.c
r36487 r37807 11 11 channel->slope = 1; 12 12 13 channel->coords.pc1_1 = channel->coords.pc2_2 = 1.0; 14 channel->coords.pc1_2 = channel->coords.pc2_1 = 0.0; 15 channel->coords.crval1 = 0.0; 16 channel->coords.crval2 = 0.0; 17 channel->coords.crpix1 = 0.0; 18 channel->coords.crpix2 = 0.0; 19 channel->coords.cdelt1 = channel->coords.cdelt2 = 1.0; 20 strcpy (channel->coords.ctype, "DEC--LIN"); 21 channel->coords.Npolyterms = 0; 13 InitCoords (&channel->coords, "DEC--LIN"); 22 14 23 15 channel->matrix.datasize = 0; /* a flag to show there is no data in the matrix */ … … 42 34 InitImageChannel (&image[0].channel[i]); 43 35 } 44 image[0].image = &image[0].channel[0]; 36 37 image[0].currentChannel = 0; 38 image[0].image = &image[0].channel[image[0].currentChannel]; 45 39 46 40 image[0].nPixels = 0; -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r37412 r37807 90 90 switch (keysym) { 91 91 92 case XK_F1: 93 image[0].image = &image[0].channel[0]; 94 SetColorScale (graphic, image); 95 Remap (graphic, image); 96 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 92 # define SET_CHANNEL_CASE(NCHAN) \ 93 case XK_F##NCHAN: \ 94 image[0].currentChannel = NCHAN-1; \ 95 image[0].image = &image[0].channel[NCHAN-1]; \ 96 SetColorScale (graphic, image); \ 97 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); \ 98 Screen_to_Image (&X, &Y, (double)(event[0].x + 0.5), (double)(event[0].y + 0.5), &image[0].picture); \ 99 UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \ 97 100 break; 98 101 99 case XK_F2: 100 image[0].image = &image[0].channel[1]; 101 SetColorScale (graphic, image); 102 Remap (graphic, image); 103 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 104 break; 102 // Remap (graphic, image); 105 103 106 case XK_F3: 107 image[0].image = &image[0].channel[2]; 108 SetColorScale (graphic, image); 109 Remap (graphic, image); 110 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 111 break; 104 // the number of entries here must match the value of NCHANNELS in contants.h 105 SET_CHANNEL_CASE(1); 106 SET_CHANNEL_CASE(2); 107 SET_CHANNEL_CASE(3); 108 SET_CHANNEL_CASE(4); 109 SET_CHANNEL_CASE(5); 110 SET_CHANNEL_CASE(6); 111 SET_CHANNEL_CASE(7); 112 SET_CHANNEL_CASE(8); 113 SET_CHANNEL_CASE(9); 114 SET_CHANNEL_CASE(10); 112 115 113 116 case XK_KP_Home: -
trunk/Ohana/src/kapa2/src/LoadPicture.c
r28241 r37807 55 55 // choose expand for wide to guarantee we fit: 56 56 wx = MAX ((header.Naxis[0] / (float) image[0].wide.dx), (header.Naxis[1] / (float) image[0].wide.dy)); 57 if (wx > 1.0) { 58 image[0].wide.expand = -wx; 59 } else { 60 image[0].wide.expand = 1.0 / wx; 61 } 57 58 // -4.002 -> -5 59 // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx); 60 image[0].wide.expand = (wx > 1.0) ? floor (-wx) : ceil (1.0 / wx); 61 // fprintf (stderr, "%d : %f\n", image[0].wide.expand, wx); 62 image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx); 63 62 64 image[0].wide.Xc = 0.5*header.Naxis[0]; 63 65 image[0].wide.Yc = 0.5*header.Naxis[1]; -
trunk/Ohana/src/kapa2/src/Reconfig.c
r21153 r37807 15 15 16 16 // if the new size is the same as the old size, do nothing. 17 if ((graphic->dx == NX) && (graphic->dy == NY)) return (TRUE); 17 if ((graphic->dx == NX) && (graphic->dy == NY)) { 18 if (USE_XWINDOW) XClearWindow (graphic->display, graphic->window); 19 Refresh (); 20 return (TRUE); 21 } 18 22 19 23 // set the new window size -
trunk/Ohana/src/kapa2/src/Remap32.c
r34088 r37807 37 37 swap_client = 0; 38 38 # endif 39 40 39 swap_server = ImageByteOrder (graphic[0].display); 41 40 swap_bytes = !(swap_client ^ swap_server); … … 91 90 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 92 91 92 unsigned short *in_base = image[0].pixmap; 93 OUT_TYPE *out_base = (OUT_TYPE *) picture[0].data; 94 95 int Ninmax = matrix[0].Naxis[0] * matrix[0].Naxis[1]; 96 int Noutmax = picture[0].dx * picture[0].dy; 97 93 98 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ 94 99 95 100 /**** fill in bottom area ****/ 96 101 for (j = 0; j < dx*j_start; j++, out_pix++) { 102 myAssert (out_pix - out_base < Noutmax, "too far out"); 97 103 *out_pix = back; 98 104 } … … 105 111 out_pix2 = out_pix + jj*dx; 106 112 for (i = 0; i < i_start; i++, out_pix2++) { 113 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 107 114 *out_pix2 = back; 108 115 } … … 114 121 if (expand_out == 1) { 115 122 for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) { 123 myAssert (out_pix - out_base < Noutmax, "too far out"); 124 myAssert (in_pix2 - in_base < Ninmax, "too far in"); 116 125 *out_pix = pixel[*in_pix2]; 117 126 } 118 127 } else { 119 128 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) { 129 myAssert (in_pix2 - in_base < Ninmax, "too far in"); 120 130 pixvalue = pixel[*in_pix2]; 121 131 out_pix2 = out_pix; 122 132 for (jj = 0; (jj < expand_out) && (j + jj < dy); jj++, out_pix2+=(dx-expand_out)) { 123 133 for (ii = 0; ii < expand_out; ii++, out_pix2++) { 134 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 124 135 *out_pix2 = pixvalue; 125 136 } … … 133 144 out_pix2 = out_pix + jj*dx; 134 145 for (i = i_end; i < dx; i++, out_pix2++) { 146 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 135 147 *out_pix2 = back; 136 148 } … … 142 154 for (j = 0; j < dy - j_end; j++) { 143 155 for (i = 0; i < dx; i++, out_pix ++) { 156 myAssert (out_pix - out_base < Noutmax, "too far out"); 144 157 *out_pix = back; 145 158 } -
trunk/Ohana/src/kapa2/src/SetChannel.c
r31665 r37807 21 21 if (Nchannel >= NCHANNELS) return (TRUE); 22 22 23 image[0].image = &image[0].channel[Nchannel]; 23 image[0].currentChannel = Nchannel; 24 image[0].image = &image[0].channel[image[0].currentChannel]; 24 25 SetColorScale (graphic, image); 25 26 … … 61 62 62 63 Refresh (); 63 XFlush (graphic[0].display);64 if (USE_XWINDOW) XFlush (graphic[0].display); 64 65 65 66 return (TRUE); -
trunk/Ohana/src/kapa2/src/UpdateStatusBox.c
r30606 r37807 20 20 21 21 bzero (line, 100); 22 snprintf (line, 100, "(%d x %d) @ %d ",23 image[0].picture.dx, image[0].picture.dy, image[0].picture.expand);22 snprintf (line, 100, "(%d x %d) @ %d ch: %d ", 23 image[0].picture.dx, image[0].picture.dy, image[0].picture.expand, image[0].currentChannel+1); 24 24 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 25 25 image[0].text_x + PAD1, image[0].text_y + 4*textpad + 4*PAD1, line, 25);
Note:
See TracChangeset
for help on using the changeset viewer.
