diff -Nru imgkap-1.11.1/debian/changelog imgkap-1.15.0/debian/changelog --- imgkap-1.11.1/debian/changelog 2015-01-16 19:09:52.000000000 +0000 +++ imgkap-1.15.0/debian/changelog 2018-02-13 21:46:30.000000000 +0000 @@ -1,18 +1,53 @@ -imgkap (1.11.1-0~precise2) precise; urgency=low +imgkap (1.15.0-0~precise1) precise; urgency=low - * 1.11 + * v1.15 - -- Pavel Kalian Fri, 16 Jan 2015 13:09:06 -0600 -imgkap (1.11.1-0~trusty2) trusty; urgency=low + -- Pavel Kalian Tue, 13 Feb 2018 15:45:03 -0600 +imgkap (1.15.0-0~trusty1) trusty; urgency=low - * 1.11 + * v1.15 - -- Pavel Kalian Fri, 16 Jan 2015 13:09:06 -0600 -imgkap (1.11.1-0~utopic2) utopic; urgency=low + -- Pavel Kalian Tue, 13 Feb 2018 15:45:03 -0600 +imgkap (1.15.0-0~xenial1) xenial; urgency=low - * 1.11 + * v1.15 + + -- Pavel Kalian Tue, 13 Feb 2018 15:45:03 -0600 +imgkap (1.15.0-0~artful1) artful; urgency=low + + * v1.15 + + -- Pavel Kalian Tue, 13 Feb 2018 15:45:03 -0600 +imgkap (1.15.0-0~bionic1) bionic; urgency=low + + * v1.15 + + -- Pavel Kalian Tue, 13 Feb 2018 15:45:03 -0600 +imgkap (1.13-0~precise1) precise; urgency=low + + * 1.13 + + -- Pavel Kalian Sat, 5 Mar 2016 12:09:06 -0600 +imgkap (1.13-0~trusty1) trusty; urgency=low + + * 1.13 + + -- Pavel Kalian Sat, 5 Mar 2016 12:09:06 -0600 +imgkap (1.13-0~vivid1) vivid; urgency=low + + * 1.13 + + -- Pavel Kalian Sat, 5 Mar 2016 12:09:06 -0600 +imgkap (1.13-0~wily1) wily; urgency=low + + * 1.13 + + -- Pavel Kalian Sat, 5 Mar 2016 12:09:06 -0600 +imgkap (1.13-0~xenial1) xenial; urgency=low + + * 1.13 - -- Pavel Kalian Fri, 16 Jan 2015 13:09:06 -0600 + -- Pavel Kalian Sat, 5 Mar 2016 12:09:06 -0600 imgkap (1.11.1-0~vivid2) vivid; urgency=low * 1.11 diff -Nru imgkap-1.11.1/debian/docs imgkap-1.15.0/debian/docs --- imgkap-1.11.1/debian/docs 2015-01-16 19:09:06.000000000 +0000 +++ imgkap-1.15.0/debian/docs 2018-02-13 21:45:06.000000000 +0000 @@ -1 +1 @@ -README +README.md Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/examples/image.png and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/examples/image.png differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/examples/PWAE10.gif and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/examples/PWAE10.gif differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/body-bg.jpg and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/body-bg.jpg differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/download-button.png and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/download-button.png differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/github-button.png and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/github-button.png differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/header-bg.jpg and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/header-bg.jpg differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/highlight-bg.jpg and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/highlight-bg.jpg differ Binary files /tmp/tmpkUvw2F/kHISWj2lnP/imgkap-1.11.1/images/sidebar-bg.jpg and /tmp/tmpkUvw2F/OxUPOBQjbJ/imgkap-1.15.0/images/sidebar-bg.jpg differ diff -Nru imgkap-1.11.1/imgkap.c imgkap-1.15.0/imgkap.c --- imgkap-1.11.1/imgkap.c 2015-01-16 18:56:51.000000000 +0000 +++ imgkap-1.15.0/imgkap.c 2018-02-13 20:17:33.000000000 +0000 @@ -1,21 +1,22 @@ /* - * This source is free writen by M'dJ at 17/05/2011 + * This source is free writen by M'dJ at 17/05/2011 extended by H.N 2016 + * As the original author is not available, please post patches and report issues at https://github.com/nohal/imgkap * Use open source FreeImage and gnu gcc * Thank to freeimage, libsb and opencpn * - * imgkap.c - Convert kap a file from/to a image file and kml to kap + * imgkap.c - Convert kap a file from/to a image file and kml to kap */ -#define VERS "1.11" +#define VERS "1.15" #include #include #include #include -#include /* for malloc() */ -#include /* for strncmp() */ +#include /* for malloc() */ +#include /* for strncmp() */ -#include /* for date in kap */ +#include /* for date in kap */ #include @@ -34,22 +35,23 @@ #define METTERS 0 #define FATHOMS 1 +#define FEET 2 -#define NORMAL 0 -#define OLDKAP 1 +#define NORMAL 0 +#define OLDKAP 1 #define COLOR_NONE 1 #define COLOR_IMG 2 #define COLOR_MAP 3 #define COLOR_KAP 4 -#define FIF_KAP 1024 -#define FIF_NO1 1025 -#define FIF_TXT 1026 -#define FIF_KML 1027 +#define FIF_KAP 1024 +#define FIF_NO1 1025 +#define FIF_TXT 1026 +#define FIF_KML 1027 -int imgtokap(int typein,char *filein, double lat0, double lon0, double lat1, double lon1, int optkap,int color,char *title, int units, char *sd,char *fileout); +int imgtokap(int typein,char *filein, double lat0, double lon0, int pixpos0x, int pixpos0y, double lat1, double lon1, int pixpos1x, int pixpos1y, int optkap,int color,char *title, int units, char *sd, int optionwgs84, char *optframe, char *fileout, char *gd, char *pr); int imgheadertokap(int typein,char *filein,int typeheader,int optkap,int color,char *title,char *fileheader,char *fileout); int kaptoimg(int typein,char *filein,int typeheader,char *fileheader,int typeout,char *fileout,char *optionpal); @@ -210,7 +212,7 @@ } histogram; -#define HistIndex2(p,l) ((((p.q.rgbRed >> l) & 0x03) << 4) | (((p.q.rgbGreen >> l) & 0x03) << 2) | ((p.q.rgbBlue >> l) & 0x03) ) +#define HistIndex2(p,l) ((((p.q.rgbRed >> l) & 0x03) << 4) | (((p.q.rgbGreen >> l) & 0x03) << 2) | ((p.q.rgbBlue >> l) & 0x03) ) #define HistSize(l) (l?sizeof(histogram):sizeof(helem)) #define HistInc(h,l) (histogram *)(((char *)h)+HistSize(l)) #define HistIndex(h,p,l) (histogram *)((char *)h+HistSize(l)*HistIndex2(p,l)) @@ -285,8 +287,8 @@ { histogram *h; - int32_t nbin; - int32_t nbout; + int32_t nbin; + int32_t nbout; int32_t colorsin; int32_t colorsout; @@ -510,7 +512,10 @@ /* get colors used */ if ((i= _HistGetList(h,e,nbcolors,6)) != nbcolors) + { + fprintf(stderr, "Can't process the palette, reduce it before using imgkap.\n"); return 0; + } /* load all color in final palette */ memset(numpal,0,sizeof(numpal)); @@ -696,21 +701,21 @@ { uint8_t l; - /* Write index table */ - while (height--) - { - /* Indices must be written as big-endian */ - l = (*index >> 24) & 0xff; - fputc(l, fp); - l = (*index >> 16) & 0xff; - fputc(l, fp); - l = (*index >> 8) & 0xff; - fputc(l, fp); - l = *index & 0xff; - fputc(l, fp); - index++; - } - return 1; + /* Write index table */ + while (height--) + { + /* Indices must be written as big-endian */ + l = (*index >> 24) & 0xff; + fputc(l, fp); + l = (*index >> 16) & 0xff; + fputc(l, fp); + l = (*index >> 8) & 0xff; + fputc(l, fp); + l = *index & 0xff; + fputc(l, fp); + index++; + } + return 1; } static uint32_t *bsb_read_index(int typein,FILE *in,uint16_t height) @@ -734,12 +739,12 @@ fseek(in,l,SEEK_SET); - /* Read index table */ - for (i=0; i < height; i++) - { + /* Read index table */ + for (i=0; i < height; i++) + { index[i] = ((uint32_t)fgetkapc(typein,in)<<24)+((uint32_t)fgetkapc(typein,in)<<16)+((uint32_t)fgetkapc(typein,in)<<8)+((uint32_t)fgetkapc(typein,in)); - } - return index; + } + return index; } /* bsb compress number, not value 0 at first write */ @@ -765,37 +770,37 @@ int bsb_compress_row(const uint8_t *buf_in, uint8_t *buf_out, uint16_t bits_out, uint16_t line, uint16_t widthin, uint16_t widthout) { - uint16_t ibuf,run_length ; - uint16_t ipixelin,ipixelout,xout; - uint8_t last_pix; - uint16_t dec, max; + uint16_t ibuf,run_length ; + uint16_t ipixelin,ipixelout,xout; + uint8_t last_pix; + uint16_t dec, max; - dec = 7-bits_out; - max = (1< ipixelout) { @@ -805,9 +810,9 @@ /* write pixel*/ ibuf += bsb_compress_nb(buf_out+ibuf,run_length,last_pix< 8) && (bits_in != 24)) - { + { FIBITMAP *bitmap24; - bitmap24 = FreeImage_ConvertTo24Bits(*bitmap); + bitmap24 = FreeImage_ConvertTo24Bits(*bitmap); if (bitmap24 == NULL) { fprintf(stderr,"ERROR - bitmap PPP is incorrect\n"); @@ -1092,7 +1097,7 @@ } fputs("OST/1\r\n", out); - fprintf(out, "IFM/%d\r\n",bits_out); + fprintf(out, "IFM/%d\r\n",bits_out); /* Write RGB tags for colormap */ for (cpt=0;cpt<8;cpt++) @@ -1110,55 +1115,54 @@ } } - fputc(0x1a, out); - fputc('\0', out); - fputc(bits_out, out); - + fputc(0x1a, out); + fputc('\0', out); + fputc(bits_out, out); - buf_in = (uint8_t *)malloc((widthin + 4)/4*4); - /* max space bsb encoded line can take */ - buf_out = (uint8_t *)malloc((widthout*2 + 8)/4*4); - index = (uint32_t *)malloc((heightout + 1) * sizeof(uint32_t)); - if ((buf_in == NULL) || (buf_out == NULL) || (index == NULL)) - { - fprintf(stderr,"ERROR - mem malloc\n"); + buf_in = (uint8_t *)malloc((widthin + 4)/4*4); + /* max space bsb encoded line can take */ + buf_out = (uint8_t *)malloc((widthout*2 + 8)/4*4); + index = (uint32_t *)malloc((heightout + 1) * sizeof(uint32_t)); + if ((buf_in == NULL) || (buf_out == NULL) || (index == NULL)) + { + fprintf(stderr,"ERROR - mem malloc\n"); return 2; - } + } last = -1; - for (i = 0; i 0) - { - if (line[0] == 0x1a) - break; - if ((s = strstr(line, "RA="))) - { - unsigned x0, y0; - - /* Attempt to read old-style NOS (4 parameter) version of RA= */ - /* then fall back to newer 2-argument version */ - if ((sscanf(s,"RA=%d,%d,%d,%d",&x0,&y0,widthout,heightout)!=4) && - (sscanf(s,"RA=%d,%d", widthout, heightout) != 2)) - { - result = 1; - break; - } - } + { + if (line[0] == 0x1a) + break; + if ((s = strstr(line, "RA="))) + { + unsigned x0, y0; + + /* Attempt to read old-style NOS (4 parameter) version of RA= */ + /* then fall back to newer 2-argument version */ + if ((sscanf(s,"RA=%d,%d,%d,%d",&x0,&y0,widthout,heightout)!=4) && + (sscanf(s,"RA=%d,%d", widthout, heightout) != 2)) + { + result = 1; + break; + } + } if (palette != NULL) { int index,r,g,b; @@ -1219,16 +1223,18 @@ p[index].rgbGreen = g; p[index].rgbBlue = b; } - } - if (depth != NULL) sscanf(line, "IFM/%d", depth); + } + if (depth != NULL) sscanf(line, "IFM/%d", depth); - if ( (rx != NULL) && (s = strstr(line, "DX=")) ) sscanf(s, "DX=%lf", rx); - if ( (ry != NULL) && (s = strstr(line, "DY=")) ) sscanf(s, "DY=%lf", ry); + if ( (rx != NULL) && (s = strstr(line, "DX=")) ) + sscanf(s, "DX=%lf", rx); + if ( (ry != NULL) && (s = strstr(line, "DY=")) ) + sscanf(s, "DY=%lf", ry); - if ((out != NULL) && (typeout != FIF_UNKNOWN)) - { - if (typeout != FIF_TXT) - { + if ((out != NULL) && (typeout != FIF_UNKNOWN)) + { + if (typeout != FIF_TXT) + { if (!strncmp(line,"RGB/",4)) continue; if (!strncmp(line,"DAY/",4)) continue; if (!strncmp(line,"DSK/",4)) continue; @@ -1237,7 +1243,7 @@ if (!strncmp(line,"GRY/",4)) continue; if (!strncmp(line,"PRC/",4)) continue; if (!strncmp(line,"PRG/",4)) continue; - } + } if ((*line == '!') && strstr(line,"M'dJ")) continue; if ((*line == '!') && strstr(line,"imgkap")) continue; @@ -1267,8 +1273,8 @@ continue; } fprintf(out,"%s\r\n",line); - } - } + } + } return result; } @@ -1290,19 +1296,19 @@ memset(palette,0,sizeof(palette)); if (optionpal && !strcasecmp(optionpal,"ALL") && (typeout != (int)FIF_TIFF) && (typeout != (int)FIF_GIF)) - { - typeout = FIF_TIFF; + { + typeout = FIF_TIFF; - fprintf(stderr,"ERROR - Palette ALL accepted with only TIF or GIF %s\n",fileout); - return 2; - } + fprintf(stderr,"ERROR - Palette ALL accepted with only TIF or GIF %s\n",fileout); + return 2; + } in = fopen(filein, "rb"); - if (in == NULL) - { - fprintf(stderr,"ERROR - Can't open KAP file %s\n",filein); - return 2; - } + if (in == NULL) + { + fprintf(stderr,"ERROR - Can't open KAP file %s\n",filein); + return 2; + } if (fileheader != NULL) { header = fopen(fileheader, "wb"); @@ -1313,7 +1319,8 @@ return 2; } } - if (typeheader == FIF_KAP) typeheader = FIF_TXT; + if (typeheader == FIF_KAP) + typeheader = FIF_TXT; result = readkapheader(typein,in,typeheader,header,NULL,NULL,COLOR_NONE,&width,&height,&rx,&ry,&bits_in,palette); if (header != NULL) fclose(header); if (result) @@ -1338,7 +1345,7 @@ index = bsb_read_index(typein,in,height); if (index == NULL) { - fprintf(stderr,"ERROR - Invalid index table in %s\n",fileheader); + fprintf(stderr,"ERROR - Invalid index table in %s\n",fileheader); fclose(in); return 3; } @@ -1440,7 +1447,7 @@ int result; RGBQUAD palette[256*8]; FIBITMAP *bitmap = 0; - FILE *out; + FILE *out; FILE *header; char datej[20]; @@ -1467,13 +1474,13 @@ } } - out = fopen(fileout, "wb"); - if (out == NULL) - { - fprintf(stderr,"ERROR - Can't open KAP file %s\n",fileout); - if (bitmap) FreeImage_Unload(bitmap); - return 2; - } + out = fopen(fileout, "wb"); + if (out == NULL) + { + fprintf(stderr,"ERROR - Can't open KAP file %s\n",fileout); + if (bitmap) FreeImage_Unload(bitmap); + return 2; + } /* Read date */ { @@ -1485,14 +1492,14 @@ strftime(datej, sizeof(datej), "%d/%m/%Y",date); } - header = fopen(fileheader, "rb"); - if (header == NULL) - { - fprintf(stderr,"ERROR - Can't open Header file %s\n",fileheader); - if (bitmap) FreeImage_Unload(bitmap); - fclose(out); - return 2; - } + header = fopen(fileheader, "rb"); + if (header == NULL) + { + fprintf(stderr,"ERROR - Can't open Header file %s\n",fileheader); + if (bitmap) FreeImage_Unload(bitmap); + fclose(out); + return 2; + } result = 1; if ((typeheader == FIF_TXT) || (typeheader == FIF_KAP)) @@ -1514,8 +1521,9 @@ if (result) { - fprintf(stderr,"ERROR - Invalid Header type %s\n",fileheader); - if (bitmap) FreeImage_Unload(bitmap); + fprintf(stderr,"ERROR - Invalid Header type %s\n",fileheader); + if (bitmap) + FreeImage_Unload(bitmap); fclose(header); fclose(out); return 2; @@ -1560,21 +1568,21 @@ } fclose(header); - if ((widthin > widthout) || (heightin > heightout)) - { - fprintf(stderr, "ERROR - Image input is greater than outpout width=%d -> %d,height=%d -> %d \n", widthin,widthout, heightin,heightout); - FreeImage_Unload(bitmap); + if ((widthin > widthout) || (heightin > heightout)) + { + fprintf(stderr, "ERROR - Image input is greater than output width=%d -> %d,height=%d -> %d \n", widthin,widthout, heightin,heightout); + FreeImage_Unload(bitmap); fclose(out); - return 2; - } + return 2; + } - if (((widthout*10/widthin) > 11) || ((heightout*10/heightin) > 11)) - { - fprintf(stderr, "ERROR - Image input is too smaller than outpout width=%d -> %d,height=%d -> %d \n", widthin,widthout, heightin,heightout); - FreeImage_Unload(bitmap); + if (((widthout*10/widthin) > 11) || ((heightout*10/heightin) > 11)) + { + fprintf(stderr, "ERROR - Image input is too smaller than output width=%d -> %d,height=%d -> %d \n", widthin,widthout, heightin,heightout); + FreeImage_Unload(bitmap); fclose(out); - return 2; - } + return 2; + } result = writeimgkap(out,&bitmap,optkap,color,(Color32 *)palette,widthin,heightin,widthout,heightout); @@ -1584,23 +1592,42 @@ return result; } -int imgtokap(int typein,char *filein, double lat0, double lon0, double lat1, double lon1,int optkap, int color, char *title,int units, char *sd,char *fileout) +int imgtokap(int typein,char *filein, double lat0, double lon0, int pixpos0x, int pixpos0y, double lat1, double lon1, int pixpos1x, int pixpos1y, int optkap, int color, char *title,int units, char *sd,int optionwgs84, char *optframe, char *fileout, char *gd, char *pr) { - uint16_t dpi,widthout,heightout; - uint32_t widthin,heightin; - double scale; - double lx,ly,dx,dy ; + uint16_t dpi,widthout,heightout,widthoutr,heightoutr; + uint32_t widthin,heightin,widthinr,heightinr; + double scale; + double lx,ly,dx,dy ; char datej[20]; int result; const char *sunits; FIBITMAP *bitmap; FREE_IMAGE_TYPE type; RGBQUAD palette[256*8]; - - FILE *out; - - sunits = "METERS"; - if (units != METTERS) sunits = "FATHOMS"; + char *filenameNU; + double londeg = 0; + double latdeg = 0; + double lat0loc = lat0; + double lat1loc = lat1; + double lon0loc = lon0; + double lon1loc = lon1; + double lon1locr, lon0locr, lat1locr, lat0locr; + uint16_t pixpos0xr,pixpos1xr,pixpos0yr,pixpos1yr; + int numxf = 0; + int xf[12]; + int yf[12]; + int i,ply = 0; + double plylat[12]; + double plylon[12]; + + FILE *out; + + switch(units) { + case METTERS: sunits = "METERS"; break; + case FATHOMS: sunits = "FATHOMS"; break; + case FEET: sunits = "FEET"; break; + default: fprintf(stderr, "ERROR - invalid units"); exit(1); + } /* get latitude and longitude */ @@ -1614,36 +1641,164 @@ /* Read image file */ bitmap = FreeImage_Load((FREE_IMAGE_FORMAT)typein,filein,BMP_DEFAULT); - if (bitmap == NULL) - { - fprintf(stderr, "ERROR - Could not open or error in image file\"%s\"\n", filein); - return 2; - } - - type = FreeImage_GetImageType(bitmap); - if (type != FIT_BITMAP) - { - fprintf(stderr, "ERROR - Image is not a bitmap file\"%s\"\n", filein); - FreeImage_Unload(bitmap); - return 2; - } - - widthin = FreeImage_GetWidth(bitmap); - heightin = FreeImage_GetHeight(bitmap); - if (!widthin || !heightin) - { - fprintf(stderr, "ERROR - Invalid image size (width=%d,height=%d)\n", widthin, heightin); - FreeImage_Unload(bitmap); - return 2; - } - - out = fopen(fileout, "wb"); - if (! out) - { - fprintf(stderr,"ERROR - Can't open KAP file %s\n",fileout); - FreeImage_Unload(bitmap); - return 2; - }; + if (bitmap == NULL) + { + fprintf(stderr, "ERROR - Could not open or error in image file\"%s\"\n", filein); + return 2; + } + + type = FreeImage_GetImageType(bitmap); + if (type != FIT_BITMAP) + { + fprintf(stderr, "ERROR - Image is not a bitmap file\"%s\"\n", filein); + FreeImage_Unload(bitmap); + return 2; + } + + widthin = FreeImage_GetWidth(bitmap); + heightin = FreeImage_GetHeight(bitmap); + if (!widthin || !heightin) + { + fprintf(stderr, "ERROR - Invalid image size (width=%d,height=%d)\n", widthin, heightin); + FreeImage_Unload(bitmap); + return 2; + } + + if (pixpos0x != -1 && pixpos0y != -1 && pixpos1x != -1 && pixpos1y != -1) + { + if (pixpos0x > widthin/3 && pixpos1x < widthin/3 && pixpos0y > heightin/3 && pixpos1y < heightin/3) + { + fprintf(stderr, "ERROR - x;y pixel position must be within the upper left third and the lower right third of the image\n"); + FreeImage_Unload(bitmap); + return 2; + } + if (pixpos0x < 0 || pixpos1x >= widthin || pixpos0y < 0 || pixpos1y >= heightin) + { + fprintf(stderr, "ERROR - x;y pixel position is outside the image\n"); + FreeImage_Unload(bitmap); + return 2; + } + + // calculate degree/pixel and extend lon0,lat0 lon1,lat1 to the edges of the image + widthoutr = widthinr = pixpos1x +1 -pixpos0x; + heightoutr = heightinr = pixpos1y +1 -pixpos0y; + + // calculate the lon,lat of the edges of the image + londeg = (lon1 - lon0) / widthinr; + lon0loc = lon0 - pixpos0x * londeg; + lon1loc = lon1 + (widthin -1 -pixpos1x) * londeg; + latdeg = (lat0 - lat1) / heightinr; + lat0loc = lat0 + pixpos0y * latdeg; + lat1loc = lat1 - (heightin -1 -pixpos1y) * latdeg; + + pixpos0xr = pixpos0x; pixpos1xr = pixpos1x; pixpos0yr = pixpos0y; pixpos1yr = pixpos1y; + if (optionwgs84 == 0) + { + lx = lontox(lon1)-lontox(lon0); + if (lx < 0) lx = -lx; + ly = lattoy_WS84(lat0)-lattoy_WS84(lat1); + if (ly < 0) ly = -ly; + + // calculate extend widthout heightout relative + dx = heightinr * lx / ly - widthinr; + dy = widthinr * ly / lx - heightinr; + + if (dy < 0) widthoutr = (int)round(widthinr + dx) ; + heightoutr = (int)round(widthoutr * ly / lx) ; + + // extend x,y of the given ref points with wgs84 correction + pixpos0xr = (int)round (pixpos0x * widthoutr / widthinr); + pixpos1xr = (int)round (pixpos1x * widthoutr / widthinr); + pixpos0yr = (int)round (pixpos0y * heightoutr / heightinr); + pixpos1yr = (int)round (pixpos1y * heightoutr / heightinr); + } + } + + // calculate REF positions if cut off an image frame + if (optframe != NULL ) + { + londeg = (lon1loc-lon0loc) / widthin; + latdeg = (lat0loc-lat1loc) / heightin; + numxf = sscanf (optframe, "%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d-%d;%d", &xf[0],&yf[0],&xf[1],&yf[1],&xf[2],&yf[2],&xf[3],&yf[3],&xf[4],&yf[4],&xf[5],&yf[5],&xf[6],&yf[6],&xf[7],&yf[7],&xf[8],&yf[8],&xf[9],&yf[9],&xf[10],&yf[10],&xf[11],&yf[11]); + ply = 0; + switch (numxf) + { + case 4 : + ply = 3; + plylon[0] = plylon[3] = lon0loc + (xf[0] * londeg); + plylon[1] = plylon[2] = lon1loc - (widthin -1 -xf[1]) * londeg; + plylat[0] = plylat[1] = lat0loc - (yf[0] * latdeg); + plylat[2] = plylat[3] = lat1loc + (heightin -1 -yf[1]) * latdeg; + break; + case 24 : + ply = 11; + plylon[11] = lon0loc + (xf[11] * londeg); + plylat[11] = lat0loc - (yf[11] * latdeg); + case 22 : + if (ply == 0) ply = 10; + plylon[10] = lon0loc + (xf[10] * londeg); + plylat[10] = lat0loc - (yf[10] * latdeg); + case 20 : + if (ply == 0) ply = 9; + plylon[9] = lon0loc + (xf[9] * londeg); + plylat[9] = lat0loc - (yf[9] * latdeg); + case 18 : + if (ply == 0) ply = 8; + plylon[8] = lon0loc + (xf[8] * londeg); + plylat[8] = lat0loc - (yf[8] * latdeg); + case 16 : + if (ply == 0) ply = 7; + plylon[7] = lon0loc + (xf[7] * londeg); + plylat[7] = lat0loc - (yf[7] * latdeg); + case 14 : + if (ply == 0) ply = 6; + plylon[6] = lon0loc + (xf[6] * londeg); + plylat[6] = lat0loc - (yf[6] * latdeg); + case 12 : + if (ply == 0) ply = 5; + plylon[5] = lon0loc + (xf[5] * londeg); + plylat[5] = lat0loc - (yf[5] * latdeg); + case 10 : + if (ply == 0) ply = 4; + plylon[4] = lon0loc + (xf[4] * londeg); + plylat[4] = lat0loc - (yf[4] * latdeg); + case 8 : + if (ply == 0) ply = 3; + plylon[3] = lon0loc + (xf[3] * londeg); + plylat[3] = lat0loc - (yf[3] * latdeg); + case 6 : + if (ply == 0) ply = 2; + plylon[0] = lon0loc + (xf[0] * londeg); + plylat[0] = lat0loc - (yf[0] * latdeg); + plylon[1] = lon0loc + (xf[1] * londeg); + plylat[1] = lat0loc - (yf[1] * latdeg); + plylon[2] = lon0loc + (xf[2] * londeg); + plylat[2] = lat0loc - (yf[2] * latdeg); + break; + + default : + fprintf(stderr,"ERROR - use -r x0f;y0f-x1f;y1f to define an rectangle area in the image which is visible from the .kap\n"); + fprintf(stderr," - use -r x0f;y0f-x1f;y1f-x2f;y2f ... to define a up to 12 edges polygon which is visible from the .kap\n"); + FreeImage_Unload(bitmap); + return 2; + } + } + else + { + ply = 3; + plylon[0] = plylon[3] = lon0loc; + plylon[1] = plylon[2] = lon1loc; + plylat[0] = plylat[1] = lat0loc; + plylat[2] = plylat[3] = lat1loc; + } + + out = fopen(fileout, "wb"); + if (! out) + { + fprintf(stderr,"ERROR - Can't open KAP file %s\n",fileout); + FreeImage_Unload(bitmap); + return 2; + }; /* Header comment file outut */ @@ -1658,53 +1813,61 @@ } /* Header comment file outut */ - fprintf(out,"! 2011 imgkap %s file generator by M'dJ\r\n", VERS); + fprintf(out,"! 2016 imgkap %s file generator by M'dJ, H.N\r\n", VERS); fprintf(out,"! Map generated not for navigation created at %s\r\n",datej); - /* calculate size */ + /* calculate size for WS84 */ dpi = 254; - lx = lontox(lon1)-lontox(lon0); + heightout = heightin; + widthout = widthin; + + lx = lontox(lon1loc)-lontox(lon0loc); if (lx < 0) lx = -lx; - ly = lattoy_WS84(lat0)-lattoy_WS84(lat1); + ly = lattoy_WS84(lat0loc)-lattoy_WS84(lat1loc); if (ly < 0) ly = -ly; - /* calculate extend widthout heightout */ - dx = heightin * lx / ly - widthin; - dy = widthin * ly / lx - heightin; - - widthout = widthin ; - if (dy < 0) widthout = (int)round(widthin + dx) ; - heightout = (int)round(widthout * ly / lx) ; + if (optionwgs84 == 0) + { + /* calculate extend widthout heightout */ + dx = heightin * lx / ly - widthin; + dy = widthin * ly / lx - heightin; + + if (dy < 0) widthout = (int)round(widthin + dx) ; + heightout = (int)round(widthout * ly / lx) ; - fprintf(out,"! Extend widthin %d heightin %d to widthout %d heightout %d\r\n", - widthin,heightin,widthout,heightout); + fprintf(out,"! Extend widthin %d heightin %d to widthout %d heightout %d\r\n", + widthin,heightin,widthout,heightout); + } scale = (1-(widthin/lx) / (heightin/ly)) *100; if ((scale > 5) || (scale < -5)) { - fprintf(stderr,"ERROR - size of image is not correct\n"); - fprintf(stderr,"\tExtend widthin %d heightin %d to widthout %d heightout %d\n", - widthin,heightin,widthout,heightout); + fprintf(stderr,"ERROR - size of image is not correct\n"); + fprintf(stderr,"\t width = %dpx LON-degree = %f \n\t height = %dpx LAT-degree = %f\n", + widthin, lon1loc-lon0loc, heightin, lat0loc-lat1loc ); FreeImage_Unload(bitmap); fclose(out); - return 2; + return 2; } /* calculate resolution en size in meters */ - dx = postod((lat0+lat1)/2,lon0,(lat0+lat1)/2,lon1); - dy = postod(lat0,lon0,lat1,lon0); + dx = postod((lat0loc+lat1loc)/2,lon0loc,(lat0loc+lat1loc)/2,lon1loc); + dy = postod(lat0loc,lon0loc,lat1loc,lon0loc); fprintf(out,"! Size in milles %.2f x %.2f\r\n",dx,dy) ; scale = round(dy*18520000.0*dpi/(heightout*254)); - if (units == METTERS) - { + switch(units) { + case METTERS: dx = dx*1852.0/(double)widthout; dy = dy*1852.0/(double)heightout; - } - else - { + break; + case FEET: + dx *= 6; + dy *= 6; + // fallthrough + case FATHOMS: dx = dx*1157500./((double)widthout*1143.); dy = dy*1157500./((double)heightout*1143.); } @@ -1724,33 +1887,47 @@ { char *s; - if (title == NULL) + s = fileout + strlen(fileout) -1; + while ((s > fileout) && (*s != '.')) s--; + if (s > fileout) *s = 0; + while ((s > fileout) && (*s != '\\') && (*s != '/')) s--; + if (s > fileout) s++; + filenameNU = s; + + if (strlen (title) == 0) { - s = fileout + strlen(fileout) -1; - while ((s > fileout) && (*s != '.')) s--; - if (s > fileout) *s = 0; - while ((s > fileout) && (*s != '\\') && (*s != '/')) s--; - if (s > fileout) s++; - title = s; } - - fprintf(out,"BSB/NA=%.70s\r\n",title); + fprintf(out,"BSB/NA=%.70s\r\n",title); } - fprintf(out," NU=UNKNOWN,RA=%d,%d,DU=%d\r\n",widthout,heightout,dpi); - fprintf(out,"KNP/SC=%0.f,GD=WGS 84,PR=MERCATOR,PP=%.2f\r\n", scale,0.0); + fprintf(out," NU=%s,RA=%d,%d,DU=%d\r\n",filenameNU,widthout,heightout,dpi); + fprintf(out,"KNP/SC=%0.f,GD=%s,PR=%s,PP=%.2f\r\n", scale, gd, pr,0.0); fputs(" PI=UNKNOWN,SP=UNKNOWN,SK=0.0,TA=90\r\n", out); fprintf(out," UN=%s,SD=%s,DX=%.2f,DY=%.2f\r\n", sunits, sd,dx,dy); - fprintf(out,"REF/1,%u,%u,%f,%f\r\n",0,0,lat0,lon0); - fprintf(out,"REF/2,%u,%u,%f,%f\r\n",widthout-1,0,lat0,lon1); - fprintf(out,"REF/3,%u,%u,%f,%f\r\n",widthout-1,heightout-1,lat1,lon1); - fprintf(out,"REF/4,%u,%u,%f,%f\r\n",0,heightout-1,lat1,lon0); - fprintf(out,"PLY/1,%f,%f\r\n",lat0,lon0); - fprintf(out,"PLY/2,%f,%f\r\n",lat0,lon1); - fprintf(out,"PLY/3,%f,%f\r\n",lat1,lon1); - fprintf(out,"PLY/4,%f,%f\r\n",lat1,lon0); + fprintf(out,"REF/1,%u,%u,%f,%f\r\n",0,0,lat0loc,lon0loc); + fprintf(out,"REF/2,%u,%u,%f,%f\r\n",widthout,0,lat0loc,lon1loc); + fprintf(out,"REF/3,%u,%u,%f,%f\r\n",widthout,heightout,lat1loc,lon1loc); + fprintf(out,"REF/4,%u,%u,%f,%f\r\n",0,heightout,lat1loc,lon0loc); + + if (pixpos0x != -1) + { + fprintf(out,"REF/5,%u,%u,%f,%f\r\n",pixpos0xr,pixpos0yr,lat0,lon0); + fprintf(out,"REF/6,%u,%u,%f,%f\r\n",pixpos1xr,pixpos0yr,lat0,lon1); + fprintf(out,"REF/7,%u,%u,%f,%f\r\n",pixpos1xr,pixpos1yr,lat1,lon1); + fprintf(out,"REF/8,%u,%u,%f,%f\r\n",pixpos0xr,pixpos1yr,lat1,lon0); + } + + for (i=0; i<=ply; i++) + { + fprintf(out,"PLY/%u,%f,%f\r\n",i+1,plylat[i],plylon[i]); + } + //ToDo + //fprintf(out,"WPX/2...,...\r\n"); + //fprintf(out,"WPY/2...,...\r\n"); + //fprintf(out,"PWX/2...,...\r\n"); + //fprintf(out,"PWY/2...,...\r\n"); fprintf(out,"DTM/%.6f,%.6f\r\n", 0.0, 0.0); @@ -1877,31 +2054,31 @@ { int result; mxml *kml,*ground,*cur; - FILE *in; + FILE *in; char *s; char buftag[1024]; - in = fopen(filein, "rb"); - if (in == NULL) - { - fprintf(stderr,"ERROR - Can't open KML file %s\n",filein); - return 2; - } + in = fopen(filein, "rb"); + if (in == NULL) + { + fprintf(stderr,"ERROR - Can't open KML file %s\n",filein); + return 2; + } if (*filein) - { + { s = filein + strlen(filein) - 1; - while ((s >= filein) && (strchr("/\\",*s) == NULL)) s--; - s[1] = 0; - } + while ((s >= filein) && (strchr("/\\",*s) == NULL)) s--; + s[1] = 0; + } kml = mxmlread(in,0,buftag); fclose(in); if (kml == NULL) { - fprintf(stderr,"ERROR - Not XML KML file %s\n",filein); - return 2; + fprintf(stderr,"ERROR - Not XML KML file %s\n",filein); + return 2; } ground = mxmlfindtag(kml,"kml"); @@ -1999,7 +2176,7 @@ #ifndef LIBIMGKAP -inline double mystrtod(char *s, char **end) +double mystrtod(char *s, char **end) { double d = 0, r = 1; @@ -2090,19 +2267,32 @@ int result = 0; char filein[1024]; char *fileheader = NULL; - char fileout[1024]; - int typein, typeheader,typeout; + char fileout[1024]; + int typein, typeheader,typeout; char *optionsd ; + char *optionframe; int optionunits = METTERS; int optionkap = NORMAL; + int optionwgs84 = 0; int optcolor; char *optionpal ; char optiontitle[256]; - double lat0,lon0,lat1,lon1; + double lat0,lon0,lat1,lon1; double l; + int pixpos0x = -1; + int pixpos0y = -1; + int pixpos1x = -1; + int pixpos1y = -1; + int pixposx = 0; + int pixposy = 0; + char optiongd[256]; + char optionpr[256]; optionsd = (char *)"UNKNOWN" ; optionpal = NULL; + optionframe = NULL; + strcpy(optiongd, "WGS84"); + strcpy(optionpr, "MERCATOR"); typein = typeheader = typeout = FIF_UNKNOWN; lat0 = lat1 = lon0 = lon1 = HUGE_VAL; @@ -2126,6 +2316,23 @@ optionunits = FATHOMS; continue; } + if (c == 'E') + { + optionunits = FEET; + continue; + } + if (c == 'W') + { + optionwgs84 = 1; + continue; + } + if (c == 'R') + { + if (argc > 1) optionframe = argv[1]; + argc--; + argv++; + continue; + } if (c == 'S') { if (argc > 1) optionsd = argv[1]; @@ -2148,6 +2355,20 @@ argv++; continue; } + if (c == 'D') + { + if (argc > 1) strcpy(optiongd,argv[1]); + argc--; + argv++; + continue; + } + if (c == 'J') + { + if (argc > 1) strcpy(optionpr,argv[1]); + argc--; + argv++; + continue; + } if ((c < '0') || (c > '9')) { result = 1; @@ -2161,36 +2382,70 @@ } if (fileheader == NULL) { - char *s; /* if numeric */ - l = strtopos(*argv,&s); - if (!*s) + // 2 pixel positions of lat,lon from command line + if ( sscanf(*argv, "%d;%d" , &pixposx, &pixposy) == 2 ) { - if (lat0 == HUGE_VAL) - { - lat0 = l; - continue; - } - if (lon0 == HUGE_VAL) + if (pixpos0x < 0) { - lon0 = l; + pixpos0x = pixposx; + pixpos0y = pixposy; continue; } - if (lat1 == HUGE_VAL) + if (pixpos1x < 0) { - lat1 = l; - continue; - } - if (lon1 == HUGE_VAL) - { - lon1 = l; + pixpos1x = pixposx; + pixpos1y = pixposy; + // if x0 > x1 mirror positions + if (pixpos0x > pixpos1x) + { + pixpos1x = pixpos0x; + pixpos0x = pixposx; + } continue; } result = 1; break; } - fileheader = *argv; - continue; + else + { + char *s; + // 2 lat0,lon0 lat1,lon1 positions + l = strtopos(*argv,&s); + if (!*s) + { + if (lat0 == HUGE_VAL) + { + lat0 = l; + continue; + } + if (lon0 == HUGE_VAL) + { + lon0 = l; + continue; + } + if (lat1 == HUGE_VAL) + { + lat1 = l; + continue; + } + if (lon1 == HUGE_VAL) + { + lon1 = l; + // if lon0 > lon1 mirror positions + if (lon0 > l) + { + lon1 = lon0; + lon0 = l; + } + continue; + } + result = 1; + break; + } + fileheader = *argv; + continue; + } } if (!*fileout) { @@ -2222,7 +2477,7 @@ typein = (int)FreeImage_GetFileType(filein,0); optcolor = COLOR_NONE; if (optionpal) optcolor = findoptlist(listoptcolor,optionpal); - result = imgtokap(typein,filein,lat0,lon0,lat1,lon1,optionkap,optcolor,optiontitle,optionunits,optionsd,fileout); + result = imgtokap(typein,filein,lat0,lon0,pixpos0x,pixpos0y,lat1,lon1,pixpos1x,pixpos1y,optionkap,optcolor,optiontitle,optionunits,optionsd,optionwgs84,optionframe,fileout,optiongd,optionpr); break; case FIF_KAP : @@ -2291,7 +2546,7 @@ result = 1; break; } - result = imgtokap(typein,filein,lat0,lon0,lat1,lon1,optionkap,optcolor,optiontitle,optionunits,optionsd,fileout); + result = imgtokap(typein,filein,lat0,lon0,pixpos0x,pixpos0y,lat1,lon1,pixpos1x,pixpos1y,optionkap,optcolor,optiontitle,optionunits,optionsd,optionwgs84,optionframe,fileout,optiongd,optionpr); break; } FreeImage_DeInitialise(); @@ -2301,42 +2556,63 @@ // sinon lire image et header ou image et position -> kap if (result == 1) - { - fprintf(stderr, "ERROR - Usage:\\imgkap [option] [inputfile] [lat0 lon0 lat1 lon1 | headerfile] [outputfile]\n"); - fprintf(stderr, "\nimgkap Version %s by M'dJ\n",VERS); - fprintf(stderr, "\nConvert kap to img :\n"); - fprintf(stderr, "\timgkap mykap.kap myimg.png : convert mykap into myimg.png\n" ); - fprintf(stderr, "\timgkap mykap.kap mheader.kap myimg.png : convert mykap into header myheader (only text header kap file) and myimg.png\n" ); - fprintf(stderr, "\nConvert img to kap : \n"); - fprintf(stderr, "\timgkap myimg.png myheaderkap.kap : convert myimg.png into myimg.kap using myheader.kap for kap informations\n" ); - fprintf(stderr, "\timgkap myimg.png myheaderkap.kap myresult.kap : convert myimg.png into myresult.kap using myheader.kap for kap informations\n" ); - fprintf(stderr, "\timgkap mykap.png lat0 lon0 lat1 lon2 myresult.kap : convert myimg.png into myresult.kap using WGS84 positioning\n" ); - fprintf(stderr, "\timgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f : convert myimg.png into myimg.kap using WGS84 positioning and options\n" ); - fprintf(stderr, "\nConvert kml to kap : \n"); - fprintf(stderr, "\timgkap mykml.kml : convert GroundOverlay mykml file into kap file using name and directory of image\n" ); - fprintf(stderr, "\timgkap mykml.kml mykap.kap: convert GroundOverlay mykml into mykap file\n" ); - fprintf(stderr, "\nWGS84 positioning :\n"); - fprintf(stderr, "\tlat0 lon0 is a left,top point\n"); - fprintf(stderr, "\tlat1 lon1 is a right,bottom point\n"); - fprintf(stderr, "\tlat to be beetwen -85 and +85 degree\n"); - fprintf(stderr, "\tlon to be beetwen -180 and +180 degree\n"); - fprintf(stderr, "\t different format are accepted : -1.22 1°10'20.123N -1d22.123 ...\n"); - fprintf(stderr, "Options :\n"); - fprintf(stderr, "\t-n : Force compatibilty all KAP software, max 127 colors\n" ); + { + fprintf(stderr, "ERROR - Usage: imgkap [option] [inputfile] [lat0 lon0 [x0;y0] lat1 lon1 [x1;y1] | headerfile] [outputfile]\n"); + fprintf(stderr, "\nUsage of imgkap Version %s by M'dJ + H.N\n",VERS); + fprintf(stderr, "\nConvert kap to img :\n"); + fprintf(stderr, " >imgkap mykap.kap myimg.png\n" ); + fprintf(stderr, " -convert mykap into myimg.png\n"); + fprintf(stderr, " >imgkap mykap.kap mheader.kap myimg.png\n" ); + fprintf(stderr, " -convert mykap into header myheader (only text file) and myimg.png\n" ); + fprintf(stderr, "\nConvert img to kap : \n"); + fprintf(stderr, " >imgkap myimg.png myheaderkap.kap\n" ); + fprintf(stderr, " -convert myimg.png into myresult.kap using myheader.kap for kap informations\n" ); + fprintf(stderr, " >imgkap mykap.png lat0 lon0 lat1 lon1 myresult.kap\n" ); + fprintf(stderr, " -convert myimg.png into myresult.kap using WGS84 positioning\n" ); + fprintf(stderr, " >imgkap mykap.png lat0 lon0 x0;y0 lat1 lon1 x1;y1 myresult.kap\n" ); + fprintf(stderr, " -convert myimg.png into myresult.kap\n" ); + fprintf(stderr, " >imgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f\n" ); + fprintf(stderr, " -convert myimg.png into myimg.kap using WGS84 positioning and options\n" ); + fprintf(stderr, "\nConvert kml to kap : \n"); + fprintf(stderr, " >imgkap mykml.kml\n" ); + fprintf(stderr, " -convert GroundOverlay mykml file into kap file using name and dir of image\n" ); + fprintf(stderr, " >imgkap mykml.kml mykap.kap\n" ); + fprintf(stderr, " -convert GroundOverlay mykml into mykap file\n" ); + fprintf(stderr, "\nWGS84 positioning :\n"); + fprintf(stderr, "\tlat0 lon0 is a left or right,top point\n"); + fprintf(stderr, "\tlat1 lon1 is a right or left,bottom point cater-cornered to lat0 lon0\n"); + fprintf(stderr, "\tlat to be between -85 and +85 degree\n"); + fprintf(stderr, "\tlon to be between -180 and +180 degree\n"); + fprintf(stderr, "\t different formats are accepted : -1.22 1°10'20.123N -1d22.123 ...\n"); + fprintf(stderr, "\tx;y pixel points can be used if lat lon defines not the image edges.\n"); + fprintf(stderr, "\t lat0 lon0 x0;y0 must be in the left or right, upper third\n"); + fprintf(stderr, "\t lat1 lon1 x1;y1 must be in the right or left, lower third\n"); + fprintf(stderr, "Options :\n"); + fprintf(stderr, "\t-w : no image size extension to WGS84 because image is already WGS84\n" ); + fprintf(stderr, "\t-r x0f;y0f-x1f;y1f \"2 pixel points -> 4 * PLY\"\n"); + fprintf(stderr, "\t : define a rectangle area in the image visible from the .kap\n" ); + fprintf(stderr, "\t-r x0f;y0f-x1f;y1f-x2f;y2f-x3f;y3f... \"3 to 12 pixel points -> PLY\"\n"); + fprintf(stderr, "\t : define a up to 12 edges polygon visible from the .kap\n" ); + fprintf(stderr, "\t-n : Force compatibility all KAP software, max 127 colors\n" ); fprintf(stderr, "\t-f : fix units to FATHOMS\n" ); - fprintf(stderr, "\t-s name : fix souding datum\n" ); + fprintf(stderr, "\t-e : fix units to FEET\n" ); + fprintf(stderr, "\t-s name : fix sounding datum\n" ); fprintf(stderr, "\t-t title : change name of map\n" ); + fprintf(stderr, "\t-j projection : change projection of map (Default: MERCATOR)\n" ); + fprintf(stderr, "\t-d datum : change geographic datum of map (Default: WGS84)\n" ); fprintf(stderr, "\t-p color : color of map\n" ); - fprintf(stderr, "\t - Kap to image color : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG\n" ); - fprintf(stderr, "\t\t ALL generate multipage image, use only with GIF or TIF" ); - fprintf(stderr, "\t - image or Kap to Kap color : NONE|KAP|MAP|IMG\n" ); - fprintf(stderr, "\t\t NONE use colors in image file, default\n" ); - fprintf(stderr, "\t\t KAP only width KAP or header file, use RGB tag in KAP file\n" ); - fprintf(stderr, "\t\t MAP generate DSK and NGB colors for map scan (< 64 colors) Black -> Gray, White -> Black\n" ); - fprintf(stderr, "\t\t IMG generate DSK and NGB colors for image (photo, satellite...)\n" ); + fprintf(stderr, "\t color (Kap to image) : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG\n" ); + fprintf(stderr, "\t ALL generate multipage image, use only with GIF or TIF\n" ); + fprintf(stderr, "\t color (image or Kap to Kap) : NONE|KAP|MAP|IMG\n" ); + fprintf(stderr, "\t NONE use colors in image file, default\n" ); + fprintf(stderr, "\t KAP only width KAP or header file, use RGB tag in KAP file\n" ); + fprintf(stderr, "\t MAP generate DSK and NGB colors for map scan\n"); + fprintf(stderr, "\t < 64 colors: Black -> Gray, White -> Black\n" ); + fprintf(stderr, "\t IMG generate DSK and NGB colors for image (photo, satellite...)\n" ); + return 1; - } - if (result) fprintf(stderr, "ERROR - imgkap return %d\n",result ); + } + if (result) fprintf(stderr, "ERROR - imgkap (%s) return %d\n", argv[1], result ); return result; } diff -Nru imgkap-1.11.1/index.html imgkap-1.15.0/index.html --- imgkap-1.11.1/index.html 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/index.html 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + Imgkap by nohal + + + +
+
+

Imgkap

+

Tool to create and convert BSB / KAP charts

+ View project on GitHub +
+
+ +
+
+
+

+imgkap 1.14

+ +

Tool to manipuate raster nautical charts in KAP format

+ +

Build Status

+ +

This repository is a Github clone of the original code created by M'dJ in 2011 and maintained by Pavel Kalian

+ +

+Usage

+ +
imgkap [option] [inputfile] [lat0 lon0 [x0;y0] lat1 lon1 [x1;y1] | headerfile] [outputfile]
+
+Usage of imgkap Version 1.14 by M'dJ + H.N
+
+Convert kap to img :
+  >imgkap mykap.kap myimg.png
+    -convert mykap into myimg.png
+  >imgkap mykap.kap mheader.kap myimg.png
+    -convert mykap into header myheader (only text file) and myimg.png
+
+Convert img to kap : 
+  >imgkap myimg.png myheaderkap.kap
+    -convert myimg.png into myresult.kap using myheader.kap for kap informations
+  >imgkap mykap.png lat0 lon0 lat1 lon1 myresult.kap
+    -convert myimg.png into myresult.kap using WGS84 positioning
+  >imgkap mykap.png lat0 lon0 x0;y0 lat1 lon1 x1;y1 myresult.kap
+    -convert myimg.png into myresult.kap
+  >imgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f
+    -convert myimg.png into myimg.kap using WGS84 positioning and options
+
+Convert kml to kap : 
+  >imgkap mykml.kml
+    -convert GroundOverlay mykml file into kap file using name and dir of image
+  >imgkap mykml.kml mykap.kap
+    -convert GroundOverlay mykml into mykap file
+
+WGS84 positioning :
+    lat0 lon0 is a left or right,top point
+    lat1 lon1 is a right or left,bottom point cater-cornered to lat0 lon0
+    lat to be between -85 and +85 degree
+    lon to be between -180 and +180 degree
+        different formats are accepted : -1.22  1°10'20.123N  -1d22.123 ...
+    x;y can be used if lat lon is not a left, top and right, bottom point
+        lat0 lon0 x0;y0 must be in the left or right, upper third
+        lat1 lon1 x1;y1 must be in the right or left, lower third
+Options :
+    -w  : no image size extension to WGS84 because image is already WGS84
+    -r x0f;y0f-x1f;y1f  "2 pixel points -> 4 * PLY"
+        : define a rectangle area in the image visible from the .kap
+    -r x0f;y0f-x1f;y1f-x2f;y2f-x3f;y3f... "3 to 12 pixel points -> PLY"
+        : define a up to 12 edges polygon visible from the .kap
+    -n  : Force compatibility all KAP software, max 127 colors
+    -f  : fix units to FATHOMS
+    -s name : fix sounding datum
+    -t title : change name of map
+    -p color : color of map
+       color (Kap to image) : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG
+         ALL generate multipage image, use only with GIF or TIF
+       color (image or Kap to Kap) :  NONE|KAP|MAP|IMG
+         NONE use colors in image file, default
+         KAP only width KAP or header file, use RGB tag in KAP file
+         MAP generate DSK and NGB colors for map scan
+           < 64 colors: Black -> Gray, White -> Black
+         IMG generate DSK and NGB colors for image (photo, satellite...)
+
+
+ + +
+
+ + + + diff -Nru imgkap-1.11.1/javascripts/main.js imgkap-1.15.0/javascripts/main.js --- imgkap-1.11.1/javascripts/main.js 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/javascripts/main.js 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1 @@ +console.log('This would be the main JS file.'); diff -Nru imgkap-1.11.1/Makefile imgkap-1.15.0/Makefile --- imgkap-1.11.1/Makefile 2015-01-16 18:56:51.000000000 +0000 +++ imgkap-1.15.0/Makefile 2018-02-13 20:17:33.000000000 +0000 @@ -8,3 +8,14 @@ clean: rm imgkap + if [ -f natl.kap ]; then \ + rm natl.kap; \ + fi + +test: imgkap + ./imgkap -w examples/image.png "52°20'" "3°40'" "1871;146" "51°40'" "1°10'" "50;934" -r "500;96-1918;96-1918;968-142;968-142;541" natl.kap + if [ -f natl.kap ]; then \ + echo "imgkap seems working correctly."; \ + else \ + echo "imgkap seems broken."; \ + fi diff -Nru imgkap-1.11.1/params.json imgkap-1.15.0/params.json --- imgkap-1.11.1/params.json 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/params.json 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,6 @@ +{ + "name": "Imgkap", + "tagline": "Tool to create and convert BSB / KAP charts", + "body": "## imgkap 1.14\r\nTool to manipuate raster nautical charts in KAP format\r\n\r\n[![Build Status](https://travis-ci.org/nohal/imgkap.svg?branch=master)](https://travis-ci.org/nohal/imgkap)\r\n\r\nThis repository is a Github clone of the original code created by M'dJ in 2011 and maintained by Pavel Kalian\r\n\r\n### Usage\r\n```\r\nimgkap [option] [inputfile] [lat0 lon0 [x0;y0] lat1 lon1 [x1;y1] | headerfile] [outputfile]\r\n\r\nUsage of imgkap Version 1.14 by M'dJ + H.N\r\n\r\nConvert kap to img :\r\n >imgkap mykap.kap myimg.png\r\n -convert mykap into myimg.png\r\n >imgkap mykap.kap mheader.kap myimg.png\r\n -convert mykap into header myheader (only text file) and myimg.png\r\n\r\nConvert img to kap : \r\n >imgkap myimg.png myheaderkap.kap\r\n -convert myimg.png into myresult.kap using myheader.kap for kap informations\r\n >imgkap mykap.png lat0 lon0 lat1 lon1 myresult.kap\r\n -convert myimg.png into myresult.kap using WGS84 positioning\r\n >imgkap mykap.png lat0 lon0 x0;y0 lat1 lon1 x1;y1 myresult.kap\r\n -convert myimg.png into myresult.kap\r\n >imgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f\r\n -convert myimg.png into myimg.kap using WGS84 positioning and options\r\n\r\nConvert kml to kap : \r\n >imgkap mykml.kml\r\n -convert GroundOverlay mykml file into kap file using name and dir of image\r\n >imgkap mykml.kml mykap.kap\r\n -convert GroundOverlay mykml into mykap file\r\n\r\nWGS84 positioning :\r\n\tlat0 lon0 is a left or right,top point\r\n\tlat1 lon1 is a right or left,bottom point cater-cornered to lat0 lon0\r\n\tlat to be between -85 and +85 degree\r\n\tlon to be between -180 and +180 degree\r\n\t different formats are accepted : -1.22 1°10'20.123N -1d22.123 ...\r\n\tx;y can be used if lat lon is not a left, top and right, bottom point\r\n\t lat0 lon0 x0;y0 must be in the left or right, upper third\r\n\t lat1 lon1 x1;y1 must be in the right or left, lower third\r\nOptions :\r\n\t-w : no image size extension to WGS84 because image is already WGS84\r\n\t-r x0f;y0f-x1f;y1f \"2 pixel points -> 4 * PLY\"\r\n\t : define a rectangle area in the image visible from the .kap\r\n\t-r x0f;y0f-x1f;y1f-x2f;y2f-x3f;y3f... \"3 to 12 pixel points -> PLY\"\r\n\t : define a up to 12 edges polygon visible from the .kap\r\n\t-n : Force compatibility all KAP software, max 127 colors\r\n\t-f : fix units to FATHOMS\r\n\t-s name : fix sounding datum\r\n\t-t title : change name of map\r\n\t-p color : color of map\r\n\t color (Kap to image) : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG\r\n\t ALL generate multipage image, use only with GIF or TIF\r\n\t color (image or Kap to Kap) : NONE|KAP|MAP|IMG\r\n\t NONE use colors in image file, default\r\n\t KAP only width KAP or header file, use RGB tag in KAP file\r\n\t MAP generate DSK and NGB colors for map scan\r\n\t < 64 colors: Black -> Gray, White -> Black\r\n\t IMG generate DSK and NGB colors for image (photo, satellite...)\r\n```\r\n", + "note": "Don't delete this file! It's used internally to help with page regeneration." +} \ No newline at end of file diff -Nru imgkap-1.11.1/README imgkap-1.15.0/README --- imgkap-1.11.1/README 2015-01-16 18:56:51.000000000 +0000 +++ imgkap-1.15.0/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -Usage: -imgkap [option] [inputfile] [lat0 lon0 lat1 lon1 | headerfile] [outputfile] - -imgkap Version 1.11 by M'dJ - -Convert kap to img : - imgkap mykap.kap myimg.png : convert mykap into myimg.png - imgkap mykap.kap mheader.kap myimg.png : convert mykap into header myheader (only text header kap file) and myimg.png - -Convert img to kap : - imgkap myimg.png myheaderkap.kap : convert myimg.png into myimg.kap using myheader.kap for kap informations - imgkap myimg.png myheaderkap.kap myresult.kap : convert myimg.png into myresult.kap using myheader.kap for kap informations - imgkap mykap.png lat0 lon0 lat1 lon2 myresult.kap : convert myimg.png into myresult.kap using WGS84 positioning - imgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f : convert myimg.png into myimg.kap using WGS84 positioning and options - -Convert kml to kap : - imgkap mykml.kml : convert GroundOverlay mykml file into kap file using name and directory of image - imgkap mykml.kml mykap.kap: convert GroundOverlay mykml into mykap file - -WGS84 positioning : - lat0 lon0 is a left,top point - lat1 lon1 is a right,bottom point - lat to be beetwen -85 and +85 degree - lon to be beetwen -180 and +180 degree - different format are accepted : -1.22 1$B!k(B10'20.123N -1d22.123 ... -Options : - -n : Force compatibilty all KAP software, max 127 colors - -f : fix units to FATHOMS - -s name : fix souding datum - -t title : change name of map - -p color : color of map - - Kap to image color : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG - ALL generate multipage image, use only with GIF or TIF - image or Kap to Kap color : NONE|KAP|MAP|IMG - NONE use colors in image file, default - KAP only width KAP or header file, use RGB tag in KAP file - MAP generate DSK and NGB colors for map scan (< 64 colors) Black -> Gray, White -> Black - IMG generate DSK and NGB colors for image (photo, satellite...) - diff -Nru imgkap-1.11.1/README.md imgkap-1.15.0/README.md --- imgkap-1.11.1/README.md 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/README.md 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,64 @@ +## imgkap 1.14 +Tool to manipuate raster nautical charts in KAP format + +[![Build Status](https://travis-ci.org/nohal/imgkap.svg?branch=master)](https://travis-ci.org/nohal/imgkap) + +This repository is a Github clone of the original code created by M'dJ in 2011 and maintained by Pavel Kalian + +### Usage +``` +imgkap [option] [inputfile] [lat0 lon0 [x0;y0] lat1 lon1 [x1;y1] | headerfile] [outputfile] + +Usage of imgkap Version 1.14 by M'dJ + H.N + +Convert kap to img : + >imgkap mykap.kap myimg.png + -convert mykap into myimg.png + >imgkap mykap.kap mheader.kap myimg.png + -convert mykap into header myheader (only text file) and myimg.png + +Convert img to kap : + >imgkap myimg.png myheaderkap.kap + -convert myimg.png into myresult.kap using myheader.kap for kap informations + >imgkap mykap.png lat0 lon0 lat1 lon1 myresult.kap + -convert myimg.png into myresult.kap using WGS84 positioning + >imgkap mykap.png lat0 lon0 x0;y0 lat1 lon1 x1;y1 myresult.kap + -convert myimg.png into myresult.kap + >imgkap -s 'LOWEST LOW WATER' myimg.png lat0 lon0 lat1 lon2 -f + -convert myimg.png into myimg.kap using WGS84 positioning and options + +Convert kml to kap : + >imgkap mykml.kml + -convert GroundOverlay mykml file into kap file using name and dir of image + >imgkap mykml.kml mykap.kap + -convert GroundOverlay mykml into mykap file + +WGS84 positioning : + lat0 lon0 is a left or right,top point + lat1 lon1 is a right or left,bottom point cater-cornered to lat0 lon0 + lat to be between -85 and +85 degree + lon to be between -180 and +180 degree + different formats are accepted : -1.22 1°10'20.123N -1d22.123 ... + x;y can be used if lat lon is not a left, top and right, bottom point + lat0 lon0 x0;y0 must be in the left or right, upper third + lat1 lon1 x1;y1 must be in the right or left, lower third +Options : + -w : no image size extension to WGS84 because image is already WGS84 + -r x0f;y0f-x1f;y1f "2 pixel points -> 4 * PLY" + : define a rectangle area in the image visible from the .kap + -r x0f;y0f-x1f;y1f-x2f;y2f-x3f;y3f... "3 to 12 pixel points -> PLY" + : define a up to 12 edges polygon visible from the .kap + -n : Force compatibility all KAP software, max 127 colors + -f : fix units to FATHOMS + -s name : fix sounding datum + -t title : change name of map + -p color : color of map + color (Kap to image) : ALL|RGB|DAY|DSK|NGT|NGR|GRY|PRC|PRG + ALL generate multipage image, use only with GIF or TIF + color (image or Kap to Kap) : NONE|KAP|MAP|IMG + NONE use colors in image file, default + KAP only width KAP or header file, use RGB tag in KAP file + MAP generate DSK and NGB colors for map scan + < 64 colors: Black -> Gray, White -> Black + IMG generate DSK and NGB colors for image (photo, satellite...) +``` diff -Nru imgkap-1.11.1/stylesheets/github-light.css imgkap-1.15.0/stylesheets/github-light.css --- imgkap-1.11.1/stylesheets/github-light.css 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/stylesheets/github-light.css 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,124 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, variable.other.constant, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header */, +.pl-s .pl-v /* string variable */ { + color: #0086b3; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #795da3; +} + +.pl-smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */, +.pl-s .pl-s1 /* string source */ { + color: #333; +} + +.pl-ent /* entity.name.tag */ { + color: #63a35c; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #a71d5d; +} + +.pl-s /* string */, +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */ { + color: #183691; +} + +.pl-v /* variable */ { + color: #ed6a43; +} + +.pl-id /* invalid.deprecated */ { + color: #b52a1d; +} + +.pl-ii /* invalid.illegal */ { + color: #f8f8f8; + background-color: #b52a1d; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + font-weight: bold; + color: #63a35c; +} + +.pl-ml /* markup.list */ { + color: #693a17; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + font-weight: bold; + color: #1d3e81; +} + +.pl-mq /* markup.quote */ { + color: #008080; +} + +.pl-mi /* markup.italic */ { + font-style: italic; + color: #333; +} + +.pl-mb /* markup.bold */ { + font-weight: bold; + color: #333; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + color: #bd2c00; + background-color: #ffecec; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + color: #55a532; + background-color: #eaffea; +} + +.pl-mdr /* meta.diff.range */ { + font-weight: bold; + color: #795da3; +} + +.pl-mo /* meta.output */ { + color: #1d3e81; +} + diff -Nru imgkap-1.11.1/stylesheets/print.css imgkap-1.15.0/stylesheets/print.css --- imgkap-1.11.1/stylesheets/print.css 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/stylesheets/print.css 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,228 @@ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + padding: 0; + margin: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; + border: 0; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-spacing: 0; + border-collapse: collapse; +} +body { + font-family: 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 13px; + line-height: 1.5; + color: #000; +} + +a { + font-weight: bold; + color: #d5000d; +} + +header { + padding-top: 35px; + padding-bottom: 10px; +} + +header h1 { + font-size: 48px; + font-weight: bold; + line-height: 1.2; + color: #303030; + letter-spacing: -1px; +} + +header h2 { + font-size: 24px; + font-weight: normal; + line-height: 1.3; + color: #aaa; + letter-spacing: -1px; +} +#downloads { + display: none; +} +#main_content { + padding-top: 20px; +} + +code, pre { + margin-bottom: 30px; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal; + font-size: 12px; + color: #222; +} + +code { + padding: 0 3px; +} + +pre { + padding: 20px; + overflow: auto; + border: solid 1px #ddd; +} +pre code { + padding: 0; +} + +ul, ol, dl { + margin-bottom: 20px; +} + + +/* COMMON STYLES */ + +table { + width: 100%; + border: 1px solid #ebebeb; +} + +th { + font-weight: 500; +} + +td { + font-weight: 300; + text-align: center; + border: 1px solid #ebebeb; +} + +form { + padding: 20px; + background: #f2f2f2; + +} + + +/* GENERAL ELEMENT TYPE STYLES */ + +h1 { + font-size: 2.8em; +} + +h2 { + margin-bottom: 8px; + font-size: 22px; + font-weight: bold; + color: #303030; +} + +h3 { + margin-bottom: 8px; + font-size: 18px; + font-weight: bold; + color: #d5000d; +} + +h4 { + font-size: 16px; + font-weight: bold; + color: #303030; +} + +h5 { + font-size: 1em; + color: #303030; +} + +h6 { + font-size: .8em; + color: #303030; +} + +p { + margin-bottom: 20px; + font-weight: 300; +} + +a { + text-decoration: none; +} + +p a { + font-weight: 400; +} + +blockquote { + padding: 0 0 0 30px; + margin-bottom: 20px; + font-size: 1.6em; + border-left: 10px solid #e9e9e9; +} + +ul li { + padding-left: 20px; + list-style-position: inside; + list-style: disc; +} + +ol li { + padding-left: 3px; + list-style-position: inside; + list-style: decimal; +} + +dl dd { + font-style: italic; + font-weight: 100; +} + +footer { + padding-top: 20px; + padding-bottom: 30px; + margin-top: 40px; + font-size: 13px; + color: #aaa; +} + +footer a { + color: #666; +} + +/* MISC */ +.clearfix:after { + display: block; + height: 0; + clear: both; + visibility: hidden; + content: '.'; +} + +.clearfix {display: inline-block;} +* html .clearfix {height: 1%;} +.clearfix {display: block;} diff -Nru imgkap-1.11.1/stylesheets/stylesheet.css imgkap-1.15.0/stylesheets/stylesheet.css --- imgkap-1.11.1/stylesheets/stylesheet.css 1970-01-01 00:00:00.000000000 +0000 +++ imgkap-1.15.0/stylesheets/stylesheet.css 2018-02-13 20:17:33.000000000 +0000 @@ -0,0 +1,881 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ + -ms-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + margin: 0.67em 0; + font-size: 2em; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + color: #000; + background: #ff0; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + height: 0; + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + margin: 0; /* 3 */ + font: inherit; /* 2 */ + color: inherit; /* 1 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-box-sizing: content-box; /* 2 */ + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; /* 1 */ +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + padding: 0.35em 0.625em 0.75em; + margin: 0 2px; + border: 1px solid #c0c0c0; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + padding: 0; /* 2 */ + border: 0; /* 1 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-spacing: 0; + border-collapse: collapse; +} + +td, +th { + padding: 0; +} + +/* LAYOUT STYLES */ +body { + font-family: 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 15px; + font-weight: 400; + line-height: 1.5; + color: #666; + background: #fafafa url(../images/body-bg.jpg) 0 0 repeat; +} + +p { + margin-top: 0; +} + +a { + color: #2879d0; +} +a:hover { + color: #2268b2; +} + +header { + padding-top: 40px; + padding-bottom: 40px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + background: #2e7bcf url(../images/header-bg.jpg) 0 0 repeat-x; + border-bottom: solid 1px #275da1; +} + +header h1 { + width: 540px; + margin-top: 0; + margin-bottom: 0.2em; + font-size: 72px; + font-weight: normal; + line-height: 1; + color: #fff; + letter-spacing: -1px; +} + +header h2 { + width: 540px; + margin-top: 0; + margin-bottom: 0; + font-size: 26px; + font-weight: normal; + line-height: 1.3; + color: #9ddcff; + letter-spacing: 0; +} + +.inner { + position: relative; + width: 940px; + margin: 0 auto; +} + +#content-wrapper { + padding-top: 30px; + border-top: solid 1px #fff; +} + +#main-content { + float: left; + width: 690px; +} + +#main-content img { + max-width: 100%; +} + +aside#sidebar { + float: right; + width: 200px; + min-height: 504px; + padding-left: 20px; + font-size: 12px; + line-height: 1.3; + background: transparent url(../images/sidebar-bg.jpg) 0 0 no-repeat; +} + +aside#sidebar p.repo-owner, +aside#sidebar p.repo-owner a { + font-weight: bold; +} + +#downloads { + margin-bottom: 40px; +} + +a.button { + width: 134px; + height: 58px; + padding-top: 22px; + padding-left: 68px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 23px; + line-height: 1.2; + color: #fff; +} +a.button small { + display: block; + font-size: 11px; +} +header a.button { + position: absolute; + top: 0; + right: 0; + background: transparent url(../images/github-button.png) 0 0 no-repeat; +} +aside a.button { + display: block; + width: 138px; + padding-left: 64px; + margin-bottom: 20px; + font-size: 21px; + background: transparent url(../images/download-button.png) 0 0 no-repeat; +} + +code, pre { + margin-bottom: 30px; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + font-size: 13px; + color: #222; +} + +code { + padding: 0 3px; + background-color: #f2f8fc; + border: solid 1px #dbe7f3; +} + +pre { + padding: 20px; + overflow: auto; + text-shadow: none; + background: #fff; + border: solid 1px #f2f2f2; +} +pre code { + padding: 0; + color: #2879d0; + background-color: #fff; + border: none; +} + +ul, ol, dl { + margin-bottom: 20px; +} + + +/* COMMON STYLES */ + +hr { + height: 0; + margin-top: 1em; + margin-bottom: 1em; + border: 0; + border-top: solid 1px #ddd; +} + +table { + width: 100%; + border: 1px solid #ebebeb; +} + +th { + font-weight: 500; +} + +td { + font-weight: 300; + text-align: center; + border: 1px solid #ebebeb; +} + +form { + padding: 20px; + background: #f2f2f2; + +} + + +/* GENERAL ELEMENT TYPE STYLES */ + +#main-content h1 { + margin-top: 0; + margin-bottom: 0; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 2.8em; + font-weight: normal; + color: #474747; + text-indent: 6px; + letter-spacing: -1px; +} + +#main-content h1:before { + padding-right: 0.3em; + margin-left: -0.9em; + color: #9ddcff; + content: "/"; +} + +#main-content h2 { + margin-bottom: 8px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 22px; + font-weight: bold; + color: #474747; + text-indent: 4px; +} +#main-content h2:before { + padding-right: 0.3em; + margin-left: -1.5em; + content: "//"; + color: #9ddcff; +} + +#main-content h3 { + margin-top: 24px; + margin-bottom: 8px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 18px; + font-weight: bold; + color: #474747; + text-indent: 3px; +} + +#main-content h3:before { + padding-right: 0.3em; + margin-left: -2em; + content: "///"; + color: #9ddcff; +} + +#main-content h4 { + margin-bottom: 8px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 15px; + font-weight: bold; + color: #474747; + text-indent: 3px; +} + +h4:before { + padding-right: 0.3em; + margin-left: -2.8em; + content: "////"; + color: #9ddcff; +} + +#main-content h5 { + margin-bottom: 8px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 14px; + color: #474747; + text-indent: 3px; +} +h5:before { + padding-right: 0.3em; + margin-left: -3.2em; + content: "/////"; + color: #9ddcff; +} + +#main-content h6 { + margin-bottom: 8px; + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: .8em; + color: #474747; + text-indent: 3px; +} +h6:before { + padding-right: 0.3em; + margin-left: -3.7em; + content: "//////"; + color: #9ddcff; +} + +p { + margin-bottom: 20px; +} + +a { + text-decoration: none; +} + +p a { + font-weight: 400; +} + +blockquote { + padding: 0 0 0 30px; + margin-bottom: 20px; + font-size: 1.6em; + border-left: 10px solid #e9e9e9; +} + +ul { + list-style-position: inside; + list-style: disc; + padding-left: 20px; +} + +ol { + list-style-position: inside; + list-style: decimal; + padding-left: 3px; +} + +dl dd { + font-style: italic; + font-weight: 100; +} + +footer { + padding-top: 20px; + padding-bottom: 30px; + margin-top: 40px; + font-size: 13px; + color: #aaa; + background: transparent url('../images/hr.png') 0 0 no-repeat; +} + +footer a { + color: #666; +} +footer a:hover { + color: #444; +} + +/* MISC */ +.clearfix:after { + display: block; + height: 0; + clear: both; + visibility: hidden; + content: '.'; +} + +.clearfix {display: inline-block;} +* html .clearfix {height: 1%;} +.clearfix {display: block;} + +/* #Media Queries +================================================== */ + +/* Smaller than standard 960 (devices and browsers) */ +@media only screen and (max-width: 959px) { } + +/* Tablet Portrait size to standard 960 (devices and browsers) */ +@media only screen and (min-width: 768px) and (max-width: 959px) { + .inner { + width: 740px; + } + header h1, header h2 { + width: 340px; + } + header h1 { + font-size: 60px; + } + header h2 { + font-size: 30px; + } + #main-content { + width: 490px; + } + #main-content h1:before, + #main-content h2:before, + #main-content h3:before, + #main-content h4:before, + #main-content h5:before, + #main-content h6:before { + padding-right: 0; + margin-left: 0; + content: none; + } +} + +/* All Mobile Sizes (devices and browser) */ +@media only screen and (max-width: 767px) { + .inner { + width: 93%; + } + header { + padding: 20px 0; + } + header .inner { + position: relative; + } + header h1, header h2 { + width: 100%; + } + header h1 { + font-size: 48px; + } + header h2 { + font-size: 24px; + } + header a.button { + position: relative; + display: inline-block; + width: auto; + height: auto; + padding: 5px 10px; + margin-top: 15px; + font-size: 13px; + line-height: 1; + color: #2879d0; + text-align: center; + background-color: #9ddcff; + background-image: none; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + } + header a.button small { + display: inline; + font-size: 13px; + } + #main-content, + aside#sidebar { + float: none; + width: 100% ! important; + } + aside#sidebar { + min-height: 0; + padding: 20px 0; + margin-top: 20px; + background-image: none; + border-top: solid 1px #ddd; + } + aside#sidebar a.button { + display: none; + } + #main-content h1:before, + #main-content h2:before, + #main-content h3:before, + #main-content h4:before, + #main-content h5:before, + #main-content h6:before { + padding-right: 0; + margin-left: 0; + content: none; + } +} + +/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */ +@media only screen and (min-width: 480px) and (max-width: 767px) { } + +/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */ +@media only screen and (max-width: 479px) { } +