Changeset 37759
- Timestamp:
- Dec 18, 2014, 2:47:00 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/kapa2
- Files:
-
- 9 edited
-
include/constants.h (modified) (1 diff)
-
include/structures.h (modified) (1 diff)
-
src/CreatePicture.c (modified) (1 diff)
-
src/Image.c (modified) (1 diff)
-
src/InterpretKeys.c (modified) (1 diff)
-
src/LoadPicture.c (modified) (1 diff)
-
src/Remap32.c (modified) (6 diffs)
-
src/SetChannel.c (modified) (1 diff)
-
src/UpdateStatusBox.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/include/constants.h
r36084 r37759 10 10 | PointerMotionMask) 11 11 12 # define NCHANNELS 312 # define NCHANNELS 10 13 13 # define NPIXELS_DYNAMIC 128 14 14 -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/include/structures.h
r32695 r37759 217 217 KapaImageChannel *image; 218 218 KapaImageChannel channel[NCHANNELS]; 219 int currentChannel; 219 220 } KapaImageWidget; 220 221 -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/CreatePicture.c
r16270 r37759 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; -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Image.c
r37386 r37759 34 34 InitImageChannel (&image[0].channel[i]); 35 35 } 36 image[0].image = &image[0].channel[0]; 36 37 image[0].currentChannel = 0; 38 image[0].image = &image[0].channel[image[0].currentChannel]; 37 39 38 40 image[0].nPixels = 0; -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/InterpretKeys.c
r25757 r37759 89 89 switch (keysym) { 90 90 91 case XK_F1: 92 image[0].image = &image[0].channel[0]; 93 SetColorScale (graphic, image); 94 Remap (graphic, image); 95 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 91 # define SET_CHANNEL_CASE(NCHAN) \ 92 case XK_F##NCHAN: \ 93 image[0].image = &image[0].channel[NCHAN-1]; \ 94 SetColorScale (graphic, image); \ 95 Remap (graphic, image); \ 96 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); \ 96 97 break; 97 98 98 case XK_F2: 99 image[0].image = &image[0].channel[1]; 100 SetColorScale (graphic, image); 101 Remap (graphic, image); 102 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 103 break; 104 105 case XK_F3: 106 image[0].image = &image[0].channel[2]; 107 SetColorScale (graphic, image); 108 Remap (graphic, image); 109 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 110 break; 99 // the number of entries here must match the value of NCHANNELS in contants.h 100 SET_CHANNEL_CASE(1); 101 SET_CHANNEL_CASE(2); 102 SET_CHANNEL_CASE(3); 103 SET_CHANNEL_CASE(4); 104 SET_CHANNEL_CASE(5); 105 SET_CHANNEL_CASE(6); 106 SET_CHANNEL_CASE(7); 107 SET_CHANNEL_CASE(8); 108 SET_CHANNEL_CASE(9); 109 SET_CHANNEL_CASE(10); 111 110 112 111 case XK_KP_Home: -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/LoadPicture.c
r28241 r37759 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]; -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Remap32.c
r34088 r37759 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 } -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/SetChannel.c
r37718 r37759 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 -
branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/UpdateStatusBox.c
r30606 r37759 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.
