Changeset 5852 for trunk/Ohana/src/kii/picture
- Timestamp:
- Dec 27, 2005, 3:23:01 PM (21 years ago)
- Location:
- trunk/Ohana/src/kii/picture
- Files:
-
- 5 edited
-
CreatePicture.c (modified) (3 diffs)
-
JPEGit24.c (modified) (4 diffs)
-
NewPicture.c (modified) (4 diffs)
-
Remap8.c (modified) (1 diff)
-
Resize.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kii/picture/CreatePicture.c
r2466 r5852 4 4 5 5 int i, j, extra; 6 char *c;6 unsigned char *c; 7 7 unsigned int *l; 8 8 unsigned int start, start1, start2, start3; … … 13 13 case 8: 14 14 REALLOCATE (layout[0].picture.data, char, layout[0].picture.dx*layout[0].picture.dy); 15 c = layout[0].picture.data;15 c = (unsigned char *) layout[0].picture.data; 16 16 for (i = 0; i < (layout[0].picture.dx*layout[0].picture.dy); i++, c++) 17 17 *c = start; … … 22 22 case 16: 23 23 REALLOCATE (layout[0].picture.data, char, 2*layout[0].picture.dy*layout[0].picture.dx); 24 c = layout[0].picture.data;24 c = (unsigned char *) layout[0].picture.data; 25 25 start1 = 0x0000ff & (start); 26 26 start2 = 0x0000ff & (start >> 8); -
trunk/Ohana/src/kii/picture/JPEGit24.c
r5700 r5852 1 1 # include "Ximage.h" 2 2 # include "jpeglib.h" 3 # include <png.h>4 # include "bDraw.h"5 3 6 4 # define WHITE_R 255 … … 18 16 int ii, i, j; 19 17 int i_start, i_end, j_start, j_end; 20 int dropback , extra; /* this is a bit of a kludge... */18 int dropback; /* this is a bit of a kludge... */ 21 19 int dx, dy, DX, DY; 22 20 int status, Nbytes, quality; … … 194 192 bDrawBuffer *buffer; 195 193 196 palette = MakePNGPalette (&Npalette);194 palette = KapaPNGPalette (&Npalette); 197 195 198 196 buffer = bDrawBufferCreate (dx, dy); … … 202 200 } 203 201 204 white = GetColorByName ("white");202 white = KapaColorByName ("white"); 205 203 for (j = 0; j < dy; j++) { 206 204 for (i = 0; i < dx; i++) { -
trunk/Ohana/src/kii/picture/NewPicture.c
r5700 r5852 1 1 # include "Ximage.h" 2 # define SCAN \3 status = read (layout[0].Ximage, buffer, 16); \4 buffer[16] = 0; \5 sscanf (buffer, "%*s %d", &Nbytes); \6 status = read (layout[0].Ximage, buffer, Nbytes); \7 buffer[status] = 0; /* make the string easy to parse */ \8 (DEBUG) && fprintf (stderr, "buffer: <%s>\n", buffer); \9 2 10 3 int NewPicture (Graphic *graphic, Layout *layout) { 11 4 12 5 Header header; 13 char buffer[1024],*buff;14 int status, bytes_left, Nbytes;6 char *buff; 7 int status, bytes_left, socket; 15 8 16 fits_free_matrix (&layout[0].matrix); 17 sprintf (buffer, "NCOLOR: %6d ", layout[0].Npixels); 18 write (layout[0].Ximage, buffer, 16); 9 socket = layout[0].Ximage; 19 10 20 fcntl (layout[0].Ximage, F_SETFL, !O_NONBLOCK); 11 KiiSendMessage (socket, "%d", layout[0].Npixels); 12 13 fcntl (socket, F_SETFL, !O_NONBLOCK); 21 14 22 15 header.Naxes = 2; 23 SCAN;24 sscanf (buffer, "%d %d %d %d %lf %lf",25 &header.Naxis[0], &header.Naxis[1], &header.bitpix,26 &header.unsign, &header.bzero, &header.bscale);27 16 28 SCAN; 29 sscanf (buffer, "%lf %lf %lf %lf %d", &layout[0].zero, &layout[0].range, &layout[0].min, &layout[0].max, &header.size); 17 KiiScanMessage (socket, "%d %d %d %d %lf %lf", &header.Naxis[0], &header.Naxis[1]); 18 KiiScanMessage (socket, "%d %d %d %d %lf %lf", &header.bitpix, &header.unsign, &header.bzero, &header.bscale); 19 KiiScanMessage (socket, "%lf %lf", &layout[0].zero, &layout[0].range); 20 KiiScanMessage (socket, "%lf %lf %d", &layout[0].min, &layout[0].max, &header.size); 21 KiiScanMessage (socket, "%lf %f %f %f %f", &layout[0].coords.crval1, &layout[0].coords.crpix1, &layout[0].coords.cdelt1, &layout[0].coords.pc1_1, &layout[0].coords.pc1_2); 22 KiiScanMessage (socket, "%lf %f %f %f %f", &layout[0].coords.crval2, &layout[0].coords.crpix2, &layout[0].coords.cdelt2, &layout[0].coords.pc2_1, &layout[0].coords.pc2_2); 23 24 KiiScanMessage (socket, "%s %s %s", layout[0].coords.ctype, layout[0].file, layout[0].buffer_name); 30 25 31 SCAN; 32 sscanf (buffer, "%lf %f %f %f %f", &layout[0].coords.crval1, &layout[0].coords.crpix1, &layout[0].coords.cdelt1, &layout[0].coords.pc1_1, &layout[0].coords.pc1_2); 33 34 SCAN; 35 sscanf (buffer, "%lf %f %f %f %f", &layout[0].coords.crval2, &layout[0].coords.crpix2, &layout[0].coords.cdelt2, &layout[0].coords.pc2_1, &layout[0].coords.pc2_2); 36 37 SCAN; 38 sscanf (buffer, "%s %s %s", layout[0].coords.ctype, layout[0].file, layout[0].buffer_name); 39 26 fits_free_matrix (&layout[0].matrix); 40 27 fits_create_matrix (&header, &layout[0].matrix); 41 28 42 fcntl ( layout[0].Ximage, F_SETFL, O_NONBLOCK);29 fcntl (socket, F_SETFL, O_NONBLOCK); 43 30 44 31 status = 1; … … 47 34 layout[0].matrix.size = 0; 48 35 while (bytes_left > 0) { 49 status = read ( layout[0].Ximage, buff, bytes_left);36 status = read (socket, buff, bytes_left); 50 37 if (status == 0) { /* No more pipe */ 51 38 fprintf (stderr, "error: pipe closed\n"); … … 59 46 } 60 47 61 (DEBUG) &&fprintf (stderr, "read %d bytes\n", layout[0].matrix.size);48 if (DEBUG) fprintf (stderr, "read %d bytes\n", layout[0].matrix.size); 62 49 /* it it not obvious this condition should kill kii, but ... */ 63 50 if (layout[0].matrix.size != header.size) { … … 69 56 70 57 Remap (graphic, layout, &layout[0].matrix); 71 (DEBUG) &&fprintf (stderr, "remapped image\n");58 if (DEBUG) fprintf (stderr, "remapped image\n"); 72 59 Refresh (graphic, layout, 0); 73 (DEBUG) &&fprintf (stderr, "refreshed\n");60 if (DEBUG) fprintf (stderr, "refreshed\n"); 74 61 XFlush (graphic[0].display); 75 62 -
trunk/Ohana/src/kii/picture/Remap8.c
r5386 r5852 68 68 if ((i_end - i_start) % expand_out == 0) dropback = 0; 69 69 70 out_pix = layout[0].picture.data;71 in_pix = (unsigned char *) (matrix[0].buffer)+ DX*(int)MAX(Y,0) + (int)MAX(X,0);70 out_pix = (unsigned char *) layout[0].picture.data; 71 in_pix = (unsigned char *) matrix[0].buffer + DX*(int)MAX(Y,0) + (int)MAX(X,0); 72 72 73 73 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ -
trunk/Ohana/src/kii/picture/Resize.c
r5700 r5852 1 1 # include "Ximage.h" 2 # define SCAN \3 status = read (layout[0].Ximage, buffer, 16); \4 buffer[16] = 0; \5 sscanf (buffer, "%*s %d", &Nbytes); \6 status = read (layout[0].Ximage, buffer, Nbytes); \7 buffer[status] = 0; /* make the string easy to parse */ \8 (DEBUG) && fprintf (stderr, "buffer: <%s>\n", buffer); \9 10 2 11 3 int Resize (Graphic *graphic, Layout *layout) { 12 4 13 int status, Nbytes;14 5 unsigned int NX, NY; 15 char buffer[128];16 6 17 SCAN; 18 sscanf (buffer, "%d %d", &NX, &NY); 7 KiiScanMessage (layout[0].Ximage, "%d %d", &NX, &NY); 19 8 20 9 NX += ZOOM_X + 3*PAD1 + 25;
Note:
See TracChangeset
for help on using the changeset viewer.
