37#include <boost/filesystem.hpp> 
   48  cv::Mat* obj_mat = MMgetPointer<cv::Mat*>(m, MTOP(obj));
 
   50  MMsetPointer<cv::Mat*>(m, MTOP(obj), 0);
 
   52  MMechostr(MSKDEBUG, 
"ObjBTMat destroyed.\n");
 
 
   66  int srcbitmap = MMpull(m);
 
   67  int channel = MMget(m, 0);
 
   68  if ((srcbitmap == NIL) || (channel == NIL))
 
   74  int src_bmp24 = MMfetch(m, MTOP(srcbitmap), 0);
 
   75  int src_bmp8 = MMfetch(m, MTOP(srcbitmap), 1);
 
   77  if (src_bmp24 == NIL || src_bmp8 == NIL)
 
   84  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(src_bmp24));
 
   85  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
   86  PtrObjVoid ptr_bitmap8 = (PtrObjVoid)MMstart(m, MTOP(src_bmp8));
 
   87  PtrObjBitmap obj_bitmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap8->Buffer));
 
   89  if ((obj_bitmap->bits == 0) || (obj_bitmap8->bits == 0))
 
   95  cv::Mat* mat = 
new cv::Mat(obj_bitmap->TailleH, obj_bitmap->TailleW, CV_8UC4);
 
  100  if ((MMpushPointer(m, mat) != 0))
 
  108  return OBJcreate(m, 
SObjBTMat, SCOL_PTR mat, NIL, 0);
 
 
  120  int obj = MMget(m, 0);
 
  128  MMset(m, 0, ITOM(0));
 
 
  141  int obj = MMget(m, 0);
 
  147  cv::Mat* mat = MMgetPointer<cv::Mat*>(m, MTOP(obj));
 
  150  if ((MMpushPointer(m, mat->data) != 0))
 
 
  170  MMechostr(MSKDEBUG, 
"_BTBLURbitmap\n");
 
  174  int blurY = MMpull(m);
 
  175  int blurX = MMpull(m);
 
  176  int bitmap = MMget(m, 0);
 
  178  if ((bitmap == NIL) || ((blurY == NIL) && (blurX == NIL)))
 
  187  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  188  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  199    cv::Size blursize(blurX, blurY);
 
  200    cv::blur(imagesrc, imagesrc, blursize);
 
  202  catch (cv::Exception& e)
 
  204    MMechostr(MSKDEBUG, 
"_BTBLURbitmap error %s\n", e.what());
 
  209  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  229  MMechostr(MSKDEBUG, 
"_BTBLURbitmapBuffer\n");
 
  233  int blurY = MMpull(m);
 
  234  int blurX = MMpull(m);
 
  235  int ibytesperpixel = MMpull(m);
 
  236  int iheight = MMpull(m);
 
  237  int iwidth = MMpull(m);
 
  238  int iBuff = MMget(m, 0);
 
  240  if ((iBuff == NIL) || (iheight == NIL) || (iwidth == NIL) || (ibytesperpixel == NIL) || ((blurY == NIL) && (blurX == NIL)))
 
  249  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
  256  ibytesperpixel = MTOI(ibytesperpixel);
 
  257  iheight = MTOI(iheight);
 
  258  iwidth = MTOI(iwidth);
 
  261  if (imagesrc.empty())
 
  269    cv::Size blursize(blurX, blurY);
 
  270    cv::blur(imagesrc, imagesrc, blursize);
 
  272  catch (cv::Exception& e)
 
  274    MMechostr(MSKDEBUG, 
"_BTBLURbitmapBuffer error %s\n", e.what());
 
  279  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  318  MMechostr(MSKDEBUG, 
"_BTFILTERbitmap\n");
 
  322  int itab = MMpull(m);
 
  323  int bitmap = MMget(m, 0);
 
  325  if ((bitmap == NIL) || (itab == NIL))
 
  331  int s = MMsize(m, MTOP(itab));
 
  332  cv::Mat kernel = cv::Mat::ones(s, s, CV_32F) / (float)(s*s);
 
  335  for (
int i = 0; i < s; i++)
 
  337    int jpp = MMfetch(m, MTOP(itab), i);
 
  340      int sj = MMsize(m, MTOP(jpp));
 
  341      for (
int j = 0; j < sj && j < s; j++)
 
  343        val = MTOF(MMfetch(m, MTOP(jpp), j));
 
  344        kernel.at<
float>(i, j) = val;
 
  351  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  352  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  363    cv::filter2D(imagesrc, imagesrc, -1, kernel);
 
  365  catch (cv::Exception& e)
 
  367    MMechostr(MSKDEBUG, 
"_BTFILTERbitmap error %s\n", e.what());
 
  372  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  414  MMechostr(MSKDEBUG, 
"_BTFILTERbitmapBuffer\n");
 
  418  int itab = MMpull(m);
 
  419  int ibytesperpixel = MMpull(m);
 
  420  int iheight = MMpull(m);
 
  421  int iwidth = MMpull(m);
 
  422  int iBuff = MMget(m, 0);
 
  424  if ((iBuff == NIL) || (iheight == NIL) || (iwidth == NIL) || (ibytesperpixel == NIL) || (itab == NIL))
 
  430  int s = MMsize(m, MTOP(itab));
 
  431  cv::Mat kernel = cv::Mat::ones(s, s, CV_32F) / (float)(s*s);
 
  434  for (
int i = 0; i < s; i++)
 
  436    int jpp = MMfetch(m, MTOP(itab), i);
 
  439      int sj = MMsize(m, MTOP(jpp));
 
  440      for (
int j = 0; j < sj && j < s; j++)
 
  442        val = MTOF(MMfetch(m, MTOP(jpp), j));
 
  443        kernel.at<
float>(i, j) = val;
 
  450  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
  457  ibytesperpixel = MTOI(ibytesperpixel);
 
  458  iheight = MTOI(iheight);
 
  459  iwidth = MTOI(iwidth);
 
  462  if (imagesrc.empty())
 
  470    cv::filter2D(imagesrc, imagesrc, -1, kernel);
 
  472  catch (cv::Exception& e)
 
  474    MMechostr(MSKDEBUG, 
"_BTFILTERbitmapBuffer error %s\n", e.what());
 
  479  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  495  MMechostr(MSKDEBUG, 
"_BTBRIGHTNESSbitmap\n");
 
  499  int icoef = MMpull(m);
 
  500  int bitmap = MMget(m, 0);
 
  502  if ((bitmap == NIL) || (icoef == NIL))
 
  509  float coef = (float)icoef / 100.0f;
 
  511  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  512  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  524    cvtColor(imagesrc, hsv, cv::COLOR_BGR2HSV);
 
  526    split(hsv, channels);
 
  527    cv::Mat H = channels[0];
 
  528    H.convertTo(H, CV_32F);
 
  529    cv::Mat S = channels[1];
 
  530    S.convertTo(S, CV_32F);
 
  531    cv::Mat V = channels[2];
 
  532    V.convertTo(V, CV_32F);
 
  534    for (
int i = 0; i < H.size().height; i++)
 
  536      for (
int j = 0; j < H.size().width; j++)
 
  539        S.at<
float>(i, j) *= coef;
 
  540        if (S.at<
float>(i, j) > 255)
 
  541          S.at<
float>(i, j) = 255;
 
  543        V.at<
float>(i, j) *= coef;
 
  544        if (V.at<
float>(i, j) > 255)
 
  545          V.at<
float>(i, j) = 255;
 
  548    H.convertTo(H, CV_8U);
 
  549    S.convertTo(S, CV_8U);
 
  550    V.convertTo(V, CV_8U);
 
  551    std::vector<cv::Mat> hsvChannels{ H,S,V };
 
  553    cv::merge(hsvChannels, hsvNew);
 
  554    cvtColor(hsvNew, imagesrc, cv::COLOR_HSV2BGR);
 
  556  catch (cv::Exception& e)
 
  558    MMechostr(MSKDEBUG, 
"_BTBRIGHTNESSbitmap error %s\n", e.what());
 
  563  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  582  MMechostr(MSKDEBUG, 
"_BTBRIGHTNESSbitmapBuffer\n");
 
  586  int icoef = MMpull(m);
 
  587  int ibytesperpixel = MMpull(m);
 
  588  int iheight = MMpull(m);
 
  589  int iwidth = MMpull(m);
 
  590  int iBuff = MMget(m, 0);
 
  592  if ((iBuff == NIL) || (iheight == NIL) || (iwidth == NIL) || (ibytesperpixel == NIL) || (icoef == NIL))
 
  599  float coef = (float)icoef / 100.0f;
 
  601  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
  608  ibytesperpixel = MTOI(ibytesperpixel);
 
  609  iheight = MTOI(iheight);
 
  610  iwidth = MTOI(iwidth);
 
  613  if (imagesrc.empty())
 
  622    cvtColor(imagesrc, hsv, cv::COLOR_BGR2HSV);
 
  624    split(hsv, channels);
 
  625    cv::Mat H = channels[0];
 
  626    H.convertTo(H, CV_32F);
 
  627    cv::Mat S = channels[1];
 
  628    S.convertTo(S, CV_32F);
 
  629    cv::Mat V = channels[2];
 
  630    V.convertTo(V, CV_32F);
 
  632    for (
int i = 0; i < H.size().height; i++)
 
  634      for (
int j = 0; j < H.size().width; j++)
 
  637        S.at<
float>(i, j) *= coef;
 
  638        if (S.at<
float>(i, j) > 255)
 
  639          S.at<
float>(i, j) = 255;
 
  641        V.at<
float>(i, j) *= coef;
 
  642        if (V.at<
float>(i, j) > 255)
 
  643          V.at<
float>(i, j) = 255;
 
  646    H.convertTo(H, CV_8U);
 
  647    S.convertTo(S, CV_8U);
 
  648    V.convertTo(V, CV_8U);
 
  649    std::vector<cv::Mat> hsvChannels{ H,S,V };
 
  651    cv::merge(hsvChannels, hsvNew);
 
  652    cvtColor(hsvNew, imagesrc, cv::COLOR_HSV2BGR);
 
  654  catch (cv::Exception& e)
 
  656    MMechostr(MSKDEBUG, 
"_BTBRIGHTNESSbitmapBuffer error %s\n", e.what());
 
  661  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  678  MMechostr(MSKDEBUG, 
"_BTLAPLACEbitmap\n");
 
  682  int iksize = MMpull(m);
 
  683  int iddepth = MMpull(m);
 
  684  int bitmap = MMget(m, 0);
 
  686  if ((bitmap == NIL) || (iddepth == NIL) || (iksize == NIL))
 
  692  int ksize = MTOI(iksize);
 
  693  int ddepth = MTOI(iddepth);
 
  695  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  696  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  707    cv::Laplacian(imagesrc, imagesrc, ddepth, ksize);
 
  709  catch (cv::Exception& e)
 
  711    MMechostr(MSKDEBUG, 
"_BTLAPLACEbitmap error %s\n", e.what());
 
  716  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  736  MMechostr(MSKDEBUG, 
"_BTLAPLACEbitmapBuffer\n");
 
  740  int iksize = MMpull(m);
 
  741  int iddepth = MMpull(m);
 
  742  int ibytesperpixel = MMpull(m);
 
  743  int iheight = MMpull(m);
 
  744  int iwidth = MMpull(m);
 
  745  int iBuff = MMget(m, 0);
 
  747  if ((iBuff == NIL) || (iheight == NIL) || (iwidth == NIL) || (ibytesperpixel == NIL) || (iksize == NIL) || (iddepth == NIL))
 
  753  int ksize = MTOI(iksize);
 
  754  int ddepth = MTOI(iddepth);
 
  756  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
  763  ibytesperpixel = MTOI(ibytesperpixel);
 
  764  iheight = MTOI(iheight);
 
  765  iwidth = MTOI(iwidth);
 
  768  if (imagesrc.empty())
 
  776    cv::Laplacian(imagesrc, imagesrc, ddepth, ksize);
 
  778  catch (cv::Exception& e)
 
  780    MMechostr(MSKDEBUG, 
"_BTLAPLACEbitmapBuffer error %s\n", e.what());
 
  785  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  800  MMechostr(MSKDEBUG, 
"_BTFLIPbitmap\n");
 
  804  int bitmap = MMget(m, 0);
 
  812  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  813  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  824    cv::flip(imagesrc, imagesrc, 1);
 
  826  catch (cv::Exception& e)
 
  828    MMechostr(MSKDEBUG, 
"_BTFLIPbitmap error %s\n", e.what());
 
  833  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  851  MMechostr(MSKDEBUG, 
"_BTFLIPbuffer\n");
 
  854  int ibytesperpixel = MMpull(m);
 
  855  int iheight = MMpull(m);
 
  856  int iwidth = MMpull(m);
 
  857  int iBuff = MMget(m, 0);
 
  858  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL))
 
  864  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
  871  ibytesperpixel = MTOI(ibytesperpixel);
 
  872  iheight = MTOI(iheight);
 
  873  iwidth = MTOI(iwidth);
 
  876  if (imagesrc.empty())
 
  884    cv::flip(imagesrc, imagesrc, 1);
 
  886  catch (cv::Exception& e)
 
  888    MMechostr(MSKDEBUG, 
"_BTFLIPbuffer error %s\n", e.what());
 
  893  MMechostr(MSKDEBUG, 
"ok\n");
 
 
  898#define ROW_PTR(img, y) ((uchar*)((img).data + (img).step * y)) 
  911  MMechostr(MSKDEBUG, 
"_BTNORMALbitmap\n");
 
  915  int iblur = MMpull(m);
 
  916  int istrength = MMpull(m);
 
  917  int bitmap = MMget(m, 0);
 
  925  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
  926  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
  934  float strength = 1.0f;
 
  935  if (istrength != NIL)
 
  936    strength = MTOF(istrength);
 
  949    if (imagesrc.channels() != 1)
 
  950      cv::cvtColor(imagesrc, bwTexture, cv::COLOR_BGR2GRAY);
 
  952      imagesrc.copyTo(bwTexture);
 
  954    cv::Mat sobelZ, sobelX, sobelY;
 
  955    cv::Sobel(bwTexture, sobelX, CV_8U, 1, 0, 3, scale, delta, cv::BORDER_DEFAULT);
 
  956    cv::Sobel(bwTexture, sobelY, CV_8U, 0, 1, 3, scale, delta, cv::BORDER_DEFAULT);
 
  957    cv::convertScaleAbs(sobelX, sobelX, 0.125, 127.5);
 
  958    cv::convertScaleAbs(sobelY, sobelY, 0.125, 127.5);
 
  960    sobelZ = cv::Mat(bwTexture.rows, bwTexture.cols, CV_8UC1);
 
  962    for (
int y = 0; y < bwTexture.rows; y++)
 
  964      uchar *sobelXPtr = 
ROW_PTR(sobelX, y);
 
  965      uchar *sobelYPtr = 
ROW_PTR(sobelY, y);
 
  966      uchar *sobelZPtr = 
ROW_PTR(sobelZ, y);
 
  968      for (
int x = 0; x < bwTexture.cols; x++)
 
  970        double Gx = ((double(sobelXPtr[x]) * 2.0) / 255.0) - 1.0;
 
  971        double Gy = -(((double(sobelYPtr[x]) * 2.0) / 255.0) - 1.0);
 
  973        cv::Vec3d dx = cv::Vec3d{ 1.0, 0.0, Gx };
 
  974        cv::Vec3d dy = cv::Vec3d{ 0.0, 1.0, Gy };
 
  975        dx = cv::normalize(dx);
 
  976        dy = cv::normalize(dy);
 
  978        cv::Vec3d nm = dx.cross(dy) * strength;
 
  979        nm = cv::normalize(nm);
 
  980        nm = (nm * 128.0) + cv::Vec3d{ 128.0, 128.0, 128.0 };
 
  981        sobelXPtr[x] = uchar(nm[2]);
 
  982        sobelYPtr[x] = uchar(nm[1]);
 
  983        sobelZPtr[x] = uchar(nm[0]);
 
  987    std::vector<cv::Mat>planes;
 
  988    planes.push_back(sobelX);
 
  989    planes.push_back(sobelY);
 
  990    planes.push_back(sobelZ);
 
  993    cv::merge(planes, normalMap);
 
  997      cv::Mat originalNormalMap = normalMap.clone();
 
  998      cv::Mat normalMapBlurred;
 
 1000      for (
int i = 0; i < 3; i++)
 
 1002        cv::GaussianBlur(normalMap, normalMapBlurred, cv::Size(13, 13), 5.0f * blur, 5.0f * blur);
 
 1003        addWeighted(normalMap, 0.4, normalMapBlurred, 0.6, 0, normalMap);
 
 1005      addWeighted(originalNormalMap, 0.3, normalMapBlurred, 0.7, 0, normalMap);
 
 1007    else if (blur < 0.0f)
 
 1009      float sharp = std::min(abs(blur), 1.0f);
 
 1010      cv::Mat originalNormalMap = normalMap.clone();
 
 1011      cv::Mat normalMapSharpen;
 
 1012      cv::Mat kernel(3, 3, CV_32F, cv::Scalar(0));
 
 1014      kernel.at<
float>(1, 1) = 5.0;
 
 1015      kernel.at<
float>(0, 1) = -1.0;
 
 1016      kernel.at<
float>(2, 1) = -1.0;
 
 1017      kernel.at<
float>(1, 0) = -1.0;
 
 1018      kernel.at<
float>(1, 2) = -1.0;
 
 1019      cv::filter2D(normalMap, normalMapSharpen, -1, kernel);
 
 1021      addWeighted(originalNormalMap, 1.0f - sharp, normalMapSharpen, sharp, 0.0, normalMap);
 
 1023    normalMap.copyTo(imagesrc);
 
 1025  catch (cv::Exception& e)
 
 1027    MMechostr(MSKDEBUG, 
"_BTNORMALbitmap error %s\n", e.what());
 
 1032  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 1052  MMechostr(MSKDEBUG, 
"_BTNORMALbitmapBuffer\n");
 
 1055  int iblur = MMpull(m);
 
 1056  int istrength = MMpull(m);
 
 1057  int ibytesperpixel = MMpull(m);
 
 1058  int iheight = MMpull(m);
 
 1059  int iwidth = MMpull(m);
 
 1060  int iBuff = MMget(m, 0);
 
 1061  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL))
 
 1067  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
 1074  ibytesperpixel = MTOI(ibytesperpixel);
 
 1075  iheight = MTOI(iheight);
 
 1076  iwidth = MTOI(iwidth);
 
 1079  if (imagesrc.empty())
 
 1085  float strength = 1.0f;
 
 1086  if (istrength != NIL)
 
 1087    strength = MTOF(istrength);
 
 1098    if (imagesrc.channels() != 1)
 
 1099      cv::cvtColor(imagesrc, bwTexture, cv::COLOR_BGR2GRAY);
 
 1101      imagesrc.copyTo(bwTexture);
 
 1103    cv::Mat sobelZ, sobelX, sobelY;
 
 1104    cv::Sobel(bwTexture, sobelX, CV_8U, 1, 0, 3, scale, delta, cv::BORDER_DEFAULT);
 
 1105    cv::Sobel(bwTexture, sobelY, CV_8U, 0, 1, 3, scale, delta, cv::BORDER_DEFAULT);
 
 1106    cv::convertScaleAbs(sobelX, sobelX, 0.125, 127.5);
 
 1107    cv::convertScaleAbs(sobelY, sobelY, 0.125, 127.5);
 
 1109    sobelZ = cv::Mat(bwTexture.rows, bwTexture.cols, CV_8UC1);
 
 1111    for (
int y = 0; y < bwTexture.rows; y++)
 
 1113      uchar *sobelXPtr = 
ROW_PTR(sobelX, y);
 
 1114      uchar *sobelYPtr = 
ROW_PTR(sobelY, y);
 
 1115      uchar *sobelZPtr = 
ROW_PTR(sobelZ, y);
 
 1117      for (
int x = 0; x < bwTexture.cols; x++)
 
 1119        double Gx = ((double(sobelXPtr[x]) * 2.0) / 255.0) - 1.0;
 
 1120        double Gy = -(((double(sobelYPtr[x]) * 2.0) / 255.0) - 1.0);
 
 1122        cv::Vec3d dx = cv::Vec3d{ 1.0, 0.0, Gx };
 
 1123        cv::Vec3d dy = cv::Vec3d{ 0.0, 1.0, Gy };
 
 1124        dx = cv::normalize(dx);
 
 1125        dy = cv::normalize(dy);
 
 1127        cv::Vec3d nm = dx.cross(dy) * strength;
 
 1128        nm = cv::normalize(nm);
 
 1129        nm = (nm * 128.0) + cv::Vec3d{ 128.0, 128.0, 128.0 };
 
 1130        sobelXPtr[x] = uchar(nm[2]);
 
 1131        sobelYPtr[x] = uchar(nm[1]);
 
 1132        sobelZPtr[x] = uchar(nm[0]);
 
 1136    std::vector<cv::Mat>planes;
 
 1137    planes.push_back(sobelX);
 
 1138    planes.push_back(sobelY);
 
 1139    planes.push_back(sobelZ);
 
 1142    cv::merge(planes, normalMap);
 
 1146      cv::Mat originalNormalMap = normalMap.clone();
 
 1147      cv::Mat normalMapBlurred;
 
 1149      for (
int i = 0; i < 3; i++)
 
 1151        cv::GaussianBlur(normalMap, normalMapBlurred, cv::Size(13, 13), 5.0f * blur, 5.0f * blur);
 
 1152        addWeighted(normalMap, 0.4, normalMapBlurred, 0.6, 0, normalMap);
 
 1154      addWeighted(originalNormalMap, 0.3, normalMapBlurred, 0.7, 0, normalMap);
 
 1156    else if (blur < 0.0f)
 
 1158      float sharp = std::min(abs(blur), 1.0f);
 
 1159      cv::Mat originalNormalMap = normalMap.clone();
 
 1160      cv::Mat normalMapSharpen;
 
 1161      cv::Mat kernel(3, 3, CV_32F, cv::Scalar(0));
 
 1163      kernel.at<
float>(1, 1) = 5.0;
 
 1164      kernel.at<
float>(0, 1) = -1.0;
 
 1165      kernel.at<
float>(2, 1) = -1.0;
 
 1166      kernel.at<
float>(1, 0) = -1.0;
 
 1167      kernel.at<
float>(1, 2) = -1.0;
 
 1168      cv::filter2D(normalMap, normalMapSharpen, -1, kernel);
 
 1170      addWeighted(originalNormalMap, 1.0f - sharp, normalMapSharpen, sharp, 0.0, normalMap);
 
 1172    normalMap.copyTo(imagesrc);
 
 1174  catch (cv::Exception& e)
 
 1176    MMechostr(MSKDEBUG, 
"_BTNORMALbitmapBuffer error %s\n", e.what());
 
 1181  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 1202  MMechostr(MSKDEBUG, 
"_BTDRAWcircle\n");
 
 1206  int ifill_color = MMpull(m);
 
 1207  int ifilled = MMpull(m);
 
 1208  int istroke_thickness = MMpull(m);
 
 1209  int istroke_color = MMpull(m);
 
 1210  int iradius = MMpull(m);
 
 1211  int ipos = MMpull(m);
 
 1212  int bitmap = MMget(m, 0);
 
 1214  if ((bitmap == NIL) || (ipos == NIL) || (iradius == NIL))
 
 1221  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
 1222  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 1224  if (obj_bitmap->bits == 0)
 
 1233  int iposX = MMfetch(m, MTOP(ipos), 0);
 
 1234  int iposY = MMfetch(m, MTOP(ipos), 1);
 
 1235  if (iposX == NIL || iposY == NIL)
 
 1242  cv::Scalar stroke_color(0);
 
 1243  int stroke_thickness = 1;
 
 1244  if (istroke_color != NIL)
 
 1246    int color = MTOI(istroke_color);
 
 1247    if (obj_bitmap->BytesPP == 1)
 
 1248      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1250      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1253  if (istroke_thickness != NIL)
 
 1254    stroke_thickness = MTOI(istroke_thickness);
 
 1257  bool filled = 
false;
 
 1259    filled = (MTOI(ifilled) != 0);
 
 1264    cv::Scalar fill_color(0);
 
 1265    if (ifill_color != NIL)
 
 1267      int color = MTOI(ifill_color);
 
 1268      if (obj_bitmap->BytesPP == 1)
 
 1269        fill_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1271        fill_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1275      cv::circle(imagesrc, cv::Point(MTOI(iposX), MTOI(iposY)), MTOI(iradius), fill_color, -1, 8);
 
 1277    catch (cv::Exception e)
 
 1279      MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1286    cv::circle(imagesrc, cv::Point(MTOI(iposX), MTOI(iposY)), MTOI(iradius), stroke_color, stroke_thickness, 8);
 
 1288  catch (cv::Exception& e)
 
 1290    MMechostr(MSKDEBUG, 
"_BTDRAWcircle error %s\n", e.what());
 
 1295  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 1319  MMechostr(MSKDEBUG, 
"_BTDRAWcircleBuffer\n");
 
 1322  int ifill_color = MMpull(m);
 
 1323  int ifilled = MMpull(m);
 
 1324  int istroke_thickness = MMpull(m);
 
 1325  int istroke_color = MMpull(m);
 
 1326  int iradius = MMpull(m);
 
 1327  int ipos = MMpull(m);
 
 1329  int ibytesperpixel = MMpull(m);
 
 1330  int iheight = MMpull(m);
 
 1331  int iwidth = MMpull(m);
 
 1332  int iBuff = MMget(m, 0);
 
 1333  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL) || (ipos == NIL) || (iradius == NIL))
 
 1339  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
 1346  ibytesperpixel = MTOI(ibytesperpixel);
 
 1347  iheight = MTOI(iheight);
 
 1348  iwidth = MTOI(iwidth);
 
 1351  if (imagesrc.empty())
 
 1358  int iposX = MMfetch(m, MTOP(ipos), 0);
 
 1359  int iposY = MMfetch(m, MTOP(ipos), 1);
 
 1360  if (iposX == NIL || iposY == NIL)
 
 1367  cv::Scalar stroke_color(0);
 
 1368  int stroke_thickness = 1;
 
 1369  if (istroke_color != NIL)
 
 1371    int color = MTOI(istroke_color);
 
 1372    if (ibytesperpixel == 1)
 
 1373      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1375      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1378  if (istroke_thickness != NIL)
 
 1379    stroke_thickness = MTOI(istroke_thickness);
 
 1382  bool filled = 
false;
 
 1384    filled = (MTOI(ifilled) != 0);
 
 1389    cv::Scalar fill_color(0);
 
 1390    if (ifill_color != NIL)
 
 1392      int color = MTOI(ifill_color);
 
 1393      if (ibytesperpixel == 1)
 
 1394        fill_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1396        fill_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1400      cv::circle(imagesrc, cv::Point(MTOI(iposX), MTOI(iposY)), MTOI(iradius), fill_color, -1, 8);
 
 1402    catch (cv::Exception e)
 
 1404      MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1411    cv::circle(imagesrc, cv::Point(MTOI(iposX), MTOI(iposY)), MTOI(iradius), stroke_color, stroke_thickness, 8);
 
 1413  catch (cv::Exception& e)
 
 1415    MMechostr(MSKDEBUG, 
"_BTDRAWcircleBuffer error %s\n", e.what());
 
 1420  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 1440  MMechostr(MSKDEBUG, 
"_BTDRAWrect\n");
 
 1443  int ifill_color = MMpull(m);
 
 1444  int ifilled = MMpull(m);
 
 1445  int istroke_thickness = MMpull(m);
 
 1446  int istroke_color = MMpull(m);
 
 1447  int irect = MMpull(m);
 
 1448  int ibitmap = MMget(m, 0);
 
 1450  if (ibitmap == NIL || irect == NIL)
 
 1457  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(ibitmap));
 
 1458  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 1462  int iposx = MMfetch(m, MTOP(irect), 0);
 
 1463  int iposy = MMfetch(m, MTOP(irect), 1);
 
 1464  int iwidth = MMfetch(m, MTOP(irect), 2);
 
 1465  int iheight = MMfetch(m, MTOP(irect), 3);
 
 1466  if (iposx == NIL || iposy == NIL || iwidth == NIL || iheight == NIL)
 
 1472  int posx = MTOI(iposx);
 
 1473  int posy = MTOI(iposy);
 
 1474  int width = MTOI(iwidth);
 
 1475  int height = MTOI(iheight);
 
 1476  cv::Rect rect(posx, posy, width, height);
 
 1480    rect.width = abs(rect.width);
 
 1481    rect.x = rect.x - rect.width;
 
 1484  if (rect.height < 0)
 
 1486    rect.height = abs(rect.height);
 
 1487    rect.y = rect.y - rect.height;
 
 1491  cv::Scalar stroke_color(0);
 
 1492  int stroke_thickness = 1;
 
 1493  if (istroke_color != NIL)
 
 1495    int color = MTOI(istroke_color);
 
 1496    if (obj_bitmap->BytesPP == 1)
 
 1497      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1499      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1502  if (istroke_thickness != NIL)
 
 1503    stroke_thickness = MTOI(istroke_thickness);
 
 1506  bool filled = 
false;
 
 1508    filled = (MTOI(ifilled) != 0);
 
 1513    cv::Scalar fill_color(0);
 
 1514    if (ifill_color != NIL)
 
 1516      int color = MTOI(ifill_color);
 
 1517      if (obj_bitmap->BytesPP == 1)
 
 1518        fill_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1520        fill_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1524      cv::rectangle(imagesrc, rect, fill_color, -1, 8);
 
 1526    catch (cv::Exception e)
 
 1528      MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1535    cv::rectangle(imagesrc, rect, stroke_color, stroke_thickness, 8);
 
 1537  catch (cv::Exception e)
 
 1539    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1543  MMechostr(MSKDEBUG, 
"end _BTDRAWrect\n");
 
 
 1567  MMechostr(MSKDEBUG, 
"_BTDRAWrectBuffer\n");
 
 1570  int ifill_color = MMpull(m);
 
 1571  int ifilled = MMpull(m);
 
 1572  int istroke_thickness = MMpull(m);
 
 1573  int istroke_color = MMpull(m);
 
 1574  int irect = MMpull(m);
 
 1576  int ibytesperpixel = MMpull(m);
 
 1577  int iheight = MMpull(m);
 
 1578  int iwidth = MMpull(m);
 
 1579  int iBuff = MMget(m, 0);
 
 1580  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL) || (irect == NIL))
 
 1586  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
 1593  ibytesperpixel = MTOI(ibytesperpixel);
 
 1594  iheight = MTOI(iheight);
 
 1595  iwidth = MTOI(iwidth);
 
 1598  if (imagesrc.empty())
 
 1605  int iposx = MMfetch(m, MTOP(irect), 0);
 
 1606  int iposy = MMfetch(m, MTOP(irect), 1);
 
 1607  int irwidth = MMfetch(m, MTOP(irect), 2);
 
 1608  int irheight = MMfetch(m, MTOP(irect), 3);
 
 1609  if (iposx == NIL || iposy == NIL || irwidth == NIL || irheight == NIL)
 
 1615  int rposx = MTOI(iposx);
 
 1616  int rposy = MTOI(iposy);
 
 1617  int rwidth = MTOI(irwidth);
 
 1618  int rheight = MTOI(irheight);
 
 1619  cv::Rect rect(rposx, rposy, rwidth, rheight);
 
 1623    rect.width = abs(rect.width);
 
 1624    rect.x = rect.x - rect.width;
 
 1627  if (rect.height < 0)
 
 1629    rect.height = abs(rect.height);
 
 1630    rect.y = rect.y - rect.height;
 
 1634  cv::Scalar stroke_color(0);
 
 1635  int stroke_thickness = 1;
 
 1636  if (istroke_color != NIL)
 
 1638    int color = MTOI(istroke_color);
 
 1639    if (ibytesperpixel == 1)
 
 1640      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1642      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1645  if (istroke_thickness != NIL)
 
 1646    stroke_thickness = MTOI(istroke_thickness);
 
 1649  bool filled = 
false;
 
 1651    filled = (MTOI(ifilled) != 0);
 
 1656    cv::Scalar fill_color(0);
 
 1657    if (ifill_color != NIL)
 
 1659      int color = MTOI(ifill_color);
 
 1660      if (ibytesperpixel == 1)
 
 1661        fill_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1663        fill_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1667      cv::rectangle(imagesrc, rect, fill_color, -1, 8);
 
 1669    catch (cv::Exception e)
 
 1671      MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1678    cv::rectangle(imagesrc, rect, stroke_color, stroke_thickness, 8);
 
 1680  catch (cv::Exception e)
 
 1682    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1686  MMechostr(MSKDEBUG, 
"end _BTDRAWrectBuffer\n");
 
 
 1707  MMechostr(MSKDEBUG, 
"_BTDRAWline\n");
 
 1710  int istroke_thickness = MMpull(m);
 
 1711  int istroke_color = MMpull(m);
 
 1712  int iend = MMpull(m);
 
 1713  int istart = MMpull(m);
 
 1714  int ibitmap = MMget(m, 0);
 
 1716  if ((ibitmap == NIL) || (istart == NIL) || (iend == NIL))
 
 1723  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(ibitmap));
 
 1724  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 1728  int istartx = MMfetch(m, MTOP(istart), 0);
 
 1729  int istarty = MMfetch(m, MTOP(istart), 1);
 
 1730  int idestx = MMfetch(m, MTOP(iend), 0);
 
 1731  int idesty = MMfetch(m, MTOP(iend), 1);
 
 1732  if (istartx == NIL || istarty == NIL || idestx == NIL || idesty == NIL)
 
 1738  cv::Point stpoint(MTOI(istartx), MTOI(istarty));
 
 1739  cv::Point dstpoint(MTOI(idestx), MTOI(idesty));
 
 1742  cv::Scalar stroke_color(0);
 
 1743  int stroke_thickness = 1;
 
 1744  if (istroke_color != NIL)
 
 1746    int color = MTOI(istroke_color);
 
 1747    if (obj_bitmap->BytesPP == 1)
 
 1748      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1750      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1753  if (istroke_thickness != NIL)
 
 1754    stroke_thickness = MTOI(istroke_thickness);
 
 1759    cv::line(imagesrc, stpoint, dstpoint, stroke_color, stroke_thickness, 8);
 
 1761  catch (cv::Exception e)
 
 1763    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1767  MMechostr(MSKDEBUG, 
"end _BTDRAWline\n");
 
 
 1790  MMechostr(MSKDEBUG, 
"_BTDRAWlineBuffer\n");
 
 1793  int istroke_thickness = MMpull(m);
 
 1794  int istroke_color = MMpull(m);
 
 1795  int iend = MMpull(m);
 
 1796  int istart = MMpull(m);
 
 1798  int ibytesperpixel = MMpull(m);
 
 1799  int iheight = MMpull(m);
 
 1800  int iwidth = MMpull(m);
 
 1801  int iBuff = MMget(m, 0);
 
 1802  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL) || (istart == NIL) || (iend == NIL))
 
 1808  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
 1815  ibytesperpixel = MTOI(ibytesperpixel);
 
 1816  iheight = MTOI(iheight);
 
 1817  iwidth = MTOI(iwidth);
 
 1820  if (imagesrc.empty())
 
 1827  int istartx = MMfetch(m, MTOP(istart), 0);
 
 1828  int istarty = MMfetch(m, MTOP(istart), 1);
 
 1829  int idestx = MMfetch(m, MTOP(iend), 0);
 
 1830  int idesty = MMfetch(m, MTOP(iend), 1);
 
 1831  if (istartx == NIL || istarty == NIL || idestx == NIL || idesty == NIL)
 
 1837  cv::Point stpoint(MTOI(istartx), MTOI(istarty));
 
 1838  cv::Point dstpoint(MTOI(idestx), MTOI(idesty));
 
 1841  cv::Scalar stroke_color(0);
 
 1842  int stroke_thickness = 1;
 
 1843  if (istroke_color != NIL)
 
 1845    int color = MTOI(istroke_color);
 
 1846    if (ibytesperpixel == 1)
 
 1847      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1849      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1852  if (istroke_thickness != NIL)
 
 1853    stroke_thickness = MTOI(istroke_thickness);
 
 1858    cv::line(imagesrc, stpoint, dstpoint, stroke_color, stroke_thickness, 8);
 
 1860  catch (cv::Exception e)
 
 1862    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1866  MMechostr(MSKDEBUG, 
"end _BTDRAWlineBuffer\n");
 
 
 1886  MMechostr(MSKDEBUG, 
"_BTDRAWpath\n");
 
 1889  int istroke_thickness = MMpull(m);
 
 1890  int istroke_color = MMpull(m);
 
 1891  int ilist = MMpull(m);
 
 1892  int ibitmap = MMget(m, 0);
 
 1894  if ((ibitmap == NIL) || (ilist == NIL))
 
 1901  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(ibitmap));
 
 1902  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 1905  std::vector<cv::Point2i> linepath;
 
 1912    ilist = MTOP(ilist);
 
 1913    while (ilist != NIL)
 
 1916      pointTuple = MTOP(MMfetch(m, ilist, 0));
 
 1917      x = MTOI(MMfetch(m, pointTuple, 0));
 
 1918      y = MTOI(MMfetch(m, pointTuple, 1));
 
 1919      ilist = MTOP(MMfetch(m, ilist, 1));
 
 1922      linepath.push_back(cv::Point2i(x, y));
 
 1927  cv::Scalar stroke_color(0);
 
 1928  int stroke_thickness = 1;
 
 1929  if (istroke_color != NIL)
 
 1931    int color = MTOI(istroke_color);
 
 1932    if (obj_bitmap->BytesPP == 1)
 
 1933      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 1935      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 1938  if (istroke_thickness != NIL)
 
 1939    stroke_thickness = MTOI(istroke_thickness);
 
 1944    cv::polylines(imagesrc, linepath, 
false, stroke_color, stroke_thickness, 8);
 
 1946  catch (cv::Exception e)
 
 1948    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 1952  MMechostr(MSKDEBUG, 
"end _BTDRAWpath\n");
 
 
 1974  MMechostr(MSKDEBUG, 
"_BTDRAWpathBuffer\n");
 
 1977  int istroke_thickness = MMpull(m);
 
 1978  int istroke_color = MMpull(m);
 
 1979  int ilist = MMpull(m);
 
 1981  int ibytesperpixel = MMpull(m);
 
 1982  int iheight = MMpull(m);
 
 1983  int iwidth = MMpull(m);
 
 1984  int iBuff = MMget(m, 0);
 
 1985  if ((iBuff == NIL) || (iwidth == NIL) || (iheight == NIL) || (ibytesperpixel == NIL) || (ilist == NIL))
 
 1991  unsigned char* buffer = MMgetPointer<unsigned char*>(m, MTOP(iBuff));
 
 1998  ibytesperpixel = MTOI(ibytesperpixel);
 
 1999  iheight = MTOI(iheight);
 
 2000  iwidth = MTOI(iwidth);
 
 2003  if (imagesrc.empty())
 
 2009  std::vector<cv::Point2i> linepath;
 
 2016    ilist = MTOP(ilist);
 
 2017    while (ilist != NIL)
 
 2020      pointTuple = MTOP(MMfetch(m, ilist, 0));
 
 2021      x = MTOI(MMfetch(m, pointTuple, 0));
 
 2022      y = MTOI(MMfetch(m, pointTuple, 1));
 
 2023      ilist = MTOP(MMfetch(m, ilist, 1));
 
 2026      linepath.push_back(cv::Point2i(x, y));
 
 2031  cv::Scalar stroke_color(0);
 
 2032  int stroke_thickness = 1;
 
 2033  if (istroke_color != NIL)
 
 2035    int color = MTOI(istroke_color);
 
 2036    if (ibytesperpixel == 1)
 
 2037      stroke_color = cv::Scalar(color & 255, color & 255, color & 255, 255);
 
 2039      stroke_color = cv::Scalar((color >> 16) & 255, (color >> 8) & 255, color & 255, 255);
 
 2042  if (istroke_thickness != NIL)
 
 2043    stroke_thickness = MTOI(istroke_thickness);
 
 2048    cv::polylines(imagesrc, linepath, 
false, stroke_color, stroke_thickness, 8);
 
 2050  catch (cv::Exception e)
 
 2052    MMechostr(MSKDEBUG, 
"%s", e.err.c_str());
 
 2056  MMechostr(MSKDEBUG, 
"end _BTDRAWpathBuffer\n");
 
 
 2075  MMechostr(MSKDEBUG, 
"_BTMOTIONdetect\n");
 
 2079  int sensivity = MMpull(m);
 
 2080  int threshold = MMpull(m);
 
 2081  int cbitmap = MMpull(m);
 
 2082  int pbitmap = MMget(m, 0);
 
 2084  if ((pbitmap == NIL) || (cbitmap == NIL) || (threshold == NIL) || (sensivity == NIL))
 
 2090  PtrObjVoid pOB = (PtrObjVoid)MMstart(m, MTOP(pbitmap));
 
 2091  PtrObjBitmap pB = (PtrObjBitmap)MMstart(m, MTOP(pOB->Buffer));
 
 2093  PtrObjVoid cOB = (PtrObjVoid)MMstart(m, MTOP(cbitmap));
 
 2094  PtrObjBitmap cB = (PtrObjBitmap)MMstart(m, MTOP(cOB->Buffer));
 
 2096  if ((pB->TailleW != cB->TailleW) || (pB->TailleH != cB->TailleH))
 
 2102  cv::Mat diff(cB->TailleH, cB->TailleW, CV_8UC3);
 
 2103  cv::Mat tmp(cB->TailleH, cB->TailleW, CV_8UC3);
 
 2108    cv::absdiff(prevImage, curImage, diff);
 
 2111    cv::cvtColor(diff, tmp, cv::COLOR_RGB2GRAY);
 
 2114    cv::threshold(tmp, tmp, MTOI(threshold), 255, cv::THRESH_BINARY);
 
 2127    int count = cv::countNonZero(tmp);
 
 2128    float percent = ((float)count / (
float)(cB->TailleH * cB->TailleW)) * 100.0f;
 
 2130    MMset(m, 0, ITOM(percent >= ((100.0f - (
float)MTOI(sensivity)) / 100.0f) ? 1 : 0));
 
 2132  catch (cv::Exception& e)
 
 2134    MMechostr(MSKDEBUG, 
"_BTMOTIONdetect error %s\n", e.what());
 
 2142  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2158  MMechostr(MSKDEBUG, 
"_BTCompBitmap\n");
 
 2162  int ifactor = MMpull(m);
 
 2163  int bitmap = MMget(m, 0);
 
 2172  if ((ifactor != NIL) && (MTOI(ifactor) > 0))
 
 2173    factor = MTOI(ifactor);
 
 2175  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
 2176  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
 2185  p.push_back(cv::IMWRITE_JPEG_QUALITY);
 
 2186  p.push_back(factor);
 
 2187  std::vector<unsigned char> buf;
 
 2192    imencode(
".jpg", imagesrc, buf, p);
 
 2194  catch (cv::Exception& e)
 
 2196    MMechostr(MSKDEBUG, 
"_BTCompBitmap error %s\n", e.what());
 
 2208  int res = MMmalloc(m, STR_SIZE(buf.size()), TYPEBUF);
 
 2215  MMstore(m, res, 0, buf.size());
 
 2216  char* buffer = MMstartstr(m, res);
 
 2217  std::vector<unsigned char>::iterator it;
 
 2219  for (it = buf.begin(); it < buf.end(); it++)
 
 2224  buffer[buf.size()] = 0;
 
 2225  MMset(m, 0, PTOM(res));
 
 2228  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2244  MMechostr(MSKDEBUG, 
"_BTUnCompBitmap\n");
 
 2248  int bitmap = MMpull(m);
 
 2249  int idata = MMget(m, 0);
 
 2251  if ((bitmap == NIL) || (idata == NIL))
 
 2257  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
 2258  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
 2266  int msize = MMsizestr(m, MTOP(idata));
 
 2267  char* smess = (
char*)MMstart(m, MTOP(idata) + 1);
 
 2270  std::vector<char> data(smess, smess + msize);
 
 2274    cv::imdecode(cv::Mat(data), 1, &imagesrc);
 
 2275    MMset(m, 0, bitmap);
 
 2277  catch (cv::Exception& e)
 
 2279    MMechostr(MSKDEBUG, 
"_BTUnCompBitmap error %s\n", e.what());
 
 2285  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2302  MMechostr(MSKDEBUG, 
"_BTSCALEbitmap\n");
 
 2306  int method = MMpull(m);
 
 2307  int srcbitmap = MMpull(m);
 
 2308  int dstbitmap = MMget(m, 0);
 
 2310  if ((srcbitmap == NIL) || (dstbitmap == NIL))
 
 2319    method = cv::INTER_NEAREST;
 
 2323    method = cv::INTER_LINEAR;
 
 2327    method = cv::INTER_CUBIC;
 
 2331    method = cv::INTER_AREA;
 
 2335    method = cv::INTER_LANCZOS4;
 
 2339    method = cv::INTER_MAX;
 
 2343    method = cv::WARP_INVERSE_MAP;
 
 2347    method = cv::INTER_LINEAR;
 
 2350  PtrObjVoid OBs = (PtrObjVoid)MMstart(m, MTOP(srcbitmap));
 
 2351  PtrObjBitmap Bs = (PtrObjBitmap)MMstart(m, MTOP(OBs->Buffer));
 
 2353  PtrObjVoid OBd = (PtrObjVoid)MMstart(m, MTOP(dstbitmap));
 
 2354  PtrObjBitmap Bd = (PtrObjBitmap)MMstart(m, MTOP(OBd->Buffer));
 
 2357  if (Bs->bits == 0 || Bd->bits == 0)
 
 2367    cv::resize(imagesrc, imgdest, cv::Size(Bd->TailleW, Bd->TailleH), 0, 0, method);
 
 2369  catch (cv::Exception& e)
 
 2371    MMechostr(MSKDEBUG, 
"_BTSCALEbitmap error %s\n", e.what());
 
 2376  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2393  MMechostr(MSKDEBUG, 
"_BTSCALEbitmap\n");
 
 2397  int method = MMpull(m);
 
 2398  int srcbitmap = MMpull(m);
 
 2399  int dstbitmap = MMget(m, 0);
 
 2401  if ((srcbitmap == NIL) || (dstbitmap == NIL))
 
 2407  int src_bmp24 = MMfetch(m, MTOP(srcbitmap), 0);
 
 2408  int src_bmp8 = MMfetch(m, MTOP(srcbitmap), 1);
 
 2409  int dst_bmp24 = MMfetch(m, MTOP(dstbitmap), 0);
 
 2410  int dst_bmp8 = MMfetch(m, MTOP(dstbitmap), 1);
 
 2412  if ((src_bmp24 == NIL) || (dst_bmp24 == NIL))
 
 2418  bool hasBmp8 = ((src_bmp8 != NIL) && (dst_bmp8 != NIL)) ? 
true : 
false;
 
 2422  PtrObjVoid ptr_src_bitmap = (PtrObjVoid)MMstart(m, MTOP(src_bmp24));
 
 2423  PtrObjBitmap obj_src_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bitmap->Buffer));
 
 2424  PtrObjVoid ptr_dst_bitmap = (PtrObjVoid)MMstart(m, MTOP(dst_bmp24));
 
 2425  PtrObjBitmap obj_dst_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bitmap->Buffer));
 
 2427  if ((obj_src_bitmap->bits == 0) || (obj_dst_bitmap->bits == 0))
 
 2436    method = cv::INTER_NEAREST;
 
 2440    method = cv::INTER_LINEAR;
 
 2444    method = cv::INTER_CUBIC;
 
 2448    method = cv::INTER_AREA;
 
 2452    method = cv::INTER_LANCZOS4;
 
 2456    method = cv::INTER_MAX;
 
 2460    method = cv::WARP_INVERSE_MAP;
 
 2464    method = cv::INTER_LINEAR;
 
 2471    cv::resize(imagesrc, imgdest, cv::Size(obj_dst_bitmap->TailleW, obj_dst_bitmap->TailleH), 0, 0, method);
 
 2473  catch (cv::Exception& e)
 
 2475    MMechostr(MSKDEBUG, 
"_BTSCALEbitmap error %s\n", e.what());
 
 2482    PtrObjVoid ptr_src_bitmap8 = (PtrObjVoid)MMstart(m, MTOP(src_bmp8));
 
 2483    PtrObjBitmap obj_src_bitmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bitmap8->Buffer));
 
 2484    PtrObjVoid ptr_dst_bitmap8 = (PtrObjVoid)MMstart(m, MTOP(dst_bmp8));
 
 2485    PtrObjBitmap obj_dst_bitmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bitmap8->Buffer));
 
 2487    if ((obj_src_bitmap8->bits == 0) || (obj_dst_bitmap8->bits == 0))
 
 2497      cv::resize(imagesrc8, imgdest8, cv::Size(obj_dst_bitmap8->TailleW, obj_dst_bitmap8->TailleH), 0, 0, method);
 
 2499    catch (cv::Exception& e)
 
 2501      MMechostr(MSKDEBUG, 
"_BTSCALEbitmap error %s\n", e.what());
 
 2507  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2530  MMechostr(MSKDEBUG, 
"_BTSCALEbitmapBuffer\n");
 
 2534  int method = MMpull(m);
 
 2535  int isbitsperpixel = MMpull(m);
 
 2536  int isheight = MMpull(m);
 
 2537  int iswidth = MMpull(m);
 
 2538  int isBuff = MMpull(m);
 
 2540  int idbitsperpixel = MMpull(m);
 
 2541  int idheight = MMpull(m);
 
 2542  int idwidth = MMpull(m);
 
 2543  int idBuff = MMget(m, 0);
 
 2545  if ((isBuff == NIL) || (iswidth == NIL) || (isheight == NIL) || (isbitsperpixel == NIL) ||
 
 2546    (idBuff == NIL) || (idwidth == NIL) || (idheight == NIL) || (idbitsperpixel == NIL))
 
 2555    method = cv::INTER_NEAREST;
 
 2559    method = cv::INTER_LINEAR;
 
 2563    method = cv::INTER_CUBIC;
 
 2567    method = cv::INTER_AREA;
 
 2571    method = cv::INTER_LANCZOS4;
 
 2575    method = cv::INTER_MAX;
 
 2579    method = cv::WARP_INVERSE_MAP;
 
 2583    method = cv::INTER_LINEAR;
 
 2586  unsigned char* sbuffer = MMgetPointer<unsigned char*>(m, MTOP(isBuff));
 
 2587  if (sbuffer == NULL)
 
 2593  isbitsperpixel = MTOI(isbitsperpixel);
 
 2594  isheight = MTOI(isheight);
 
 2595  iswidth = MTOI(iswidth);
 
 2598  if (imagesrc.empty())
 
 2604  unsigned char* dbuffer = MMgetPointer<unsigned char*>(m, MTOP(idBuff));
 
 2605  if (dbuffer == NULL)
 
 2611  idbitsperpixel = MTOI(idbitsperpixel);
 
 2612  idheight = MTOI(idheight);
 
 2613  idwidth = MTOI(idwidth);
 
 2616  if (imgdest.empty())
 
 2624    cv::resize(imagesrc, imgdest, cv::Size(idwidth, idheight), 0, 0, method);
 
 2626  catch (cv::Exception& e)
 
 2628    MMechostr(MSKDEBUG, 
"_BTSCALEbitmapBuffer error %s\n", e.what());
 
 2633  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2649  MMechostr(MSKDEBUG, 
"_BTSAVEbitmap\n");
 
 2652  int ipath = MMpull(m);
 
 2653  int ibitmap = MMget(m, 0);
 
 2655  if (ibitmap == NIL || ipath == NIL)
 
 2657    MMechostr(MSKRUNTIME, 
"_BTSAVEbitmap error: some arguments are NIL\n");
 
 2663  boost::filesystem::path path = MMstartstr(m, MTOP(ipath));
 
 2666  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(ibitmap));
 
 2667  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 2669  if (obj_bitmap->bits == 0)
 
 2681    if (boost::filesystem::exists(path))
 
 2682      boost::filesystem::remove(path);
 
 2684    imwrite(path.generic_string(), bitmap);
 
 2686  catch (cv::Exception& ex)
 
 2688    MMechostr(MSKRUNTIME, 
"_BTSAVEbitmap Exception writing image in %s : %s\n", path.generic_string().c_str(), ex.what());
 
 2694  Mpushstrbloc(m, (
char*)path.generic_string().c_str());
 
 2697  MMechostr(MSKDEBUG, 
"end _BTSAVEbitmap\n");
 
 
 2714  MMechostr(MSKDEBUG, 
"_BTSAVEbitmapWithAlpha\n");
 
 2716  int ipath = MMpull(m);
 
 2717  int ialphabitmap = MMget(m, 0);
 
 2719  if (ialphabitmap == NIL || ipath == NIL)
 
 2721    MMechostr(MSKRUNTIME, 
"_BTSAVEalphaBitmap error: some arguments are NIL\n");
 
 2727  boost::filesystem::path path = MMstartstr(m, MTOP(ipath));
 
 2729  int bmp24 = MMfetch(m, MTOP(ialphabitmap), 0);
 
 2730  int bmp8 = MMfetch(m, MTOP(ialphabitmap), 1);
 
 2733  PtrObjVoid ptr_bitmap = (PtrObjVoid)MMstart(m, MTOP(bmp24));
 
 2734  PtrObjBitmap obj_bitmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap->Buffer));
 
 2736  PtrObjVoid ptr_bitmap8 = (PtrObjVoid)MMstart(m, MTOP(bmp8));
 
 2737  PtrObjBitmap obj_bitmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_bitmap8->Buffer));
 
 2739  if (obj_bitmap->bits == 0)
 
 2746  cv::Mat bitmap(obj_bitmap->TailleH, obj_bitmap->TailleW, CV_8UC4);
 
 2752    if (boost::filesystem::exists(path))
 
 2753      boost::filesystem::remove(path);
 
 2755    imwrite(path.generic_string(), bitmap);
 
 2757  catch (cv::Exception& ex)
 
 2759    MMechostr(MSKRUNTIME, 
"_BTSAVEalphaBitmap Exception writing image in %s : %s\n", path.generic_string().c_str(), ex.what());
 
 2765  Mpushstrbloc(m, (
char*)path.generic_string().c_str());
 
 2768  MMechostr(MSKDEBUG, 
"end _BTSAVEbitmapWithAlpha\n");
 
 
 2785        MMechostr(MSKDEBUG, 
"_BTLOADbitmap\n");
 
 2788        int ipath = MMpull(m);
 
 2796  boost::filesystem::path path = MMstartstr(m, MTOP(ipath));
 
 2798  cv::Mat lbitmap = cv::imread(path.generic_string(), cv::IMREAD_COLOR);
 
 2801    MMechostr(MSKRUNTIME, 
"_BTLOADbitmap : Could not read the image file > %s\n", path.generic_string().c_str());
 
 2810  MMpush(m, ITOM(lbitmap.cols));
 
 2811        MMpush(m, ITOM(lbitmap.rows));
 
 2815        if ((MMpush(m, Msearchinsyspak(m, 
"_CRbitmap"))) < 0)
 
 2817                MMechostr(0, 
"\n_GETarMarkerBitmap : error interpreting _CRbitmap\n");
 
 2827        int objbmp = MMget(m, 0);
 
 2830    MMechostr(MSKRUNTIME, 
"_BTLOADbitmap : Could not create the bitmap from file > %s\n", path.generic_string().c_str());
 
 2835        PtrObjVoid OB = (PtrObjVoid) MMstart(m, MTOP(objbmp));
 
 2836  PtrObjBitmap B = (PtrObjBitmap) MMstart(m, MTOP(OB->Buffer));
 
 2846                MMechostr(MSKDEBUG, 
"ok\n");
 
 
 2866  MMechostr(MSKDEBUG, 
"_BTBLENDbitmaps\n");
 
 2869  int imix = MMpull(m);
 
 2870  int isrcrect = MMpull(m);
 
 2871  int isrcbmap = MMpull(m);
 
 2872  int idstrect = MMpull(m);
 
 2873  int idstbmap = MMget(m, 0);
 
 2875  if (imix == NIL || isrcrect == NIL || isrcbmap == NIL || idstrect == NIL || idstbmap == NIL)
 
 2877    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmaps error: some arguments are NIL\n");
 
 2882  float mix = MAX(MIN(MTOF(imix), 1.0f), 0.0f);
 
 2884  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 2885  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 2886  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 2887  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 2888  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 2890    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmaps error: some dest rect parameters are NIL\n");
 
 2895  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 2896  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 2897  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 2898  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 2899  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 2901    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmaps error: some src rect parameters are NIL\n");
 
 2908  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 2909  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 2914  PtrObjVoid ptr_dst_bmap = (PtrObjVoid)MMstart(m, MTOP(idstbmap));
 
 2915  PtrObjVoid ptr_src_bmap = (PtrObjVoid)MMstart(m, MTOP(isrcbmap));
 
 2917  PtrObjBitmap obj_dst_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap->Buffer));
 
 2918  PtrObjBitmap obj_src_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap->Buffer));
 
 2920  if ((obj_dst_bmap->bits == 0) || (obj_src_bmap->bits == 0))
 
 2933    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmaps error: src rect size <= 0\n");
 
 2940  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 2941  cv::Mat src_subbmap = src_bmap(src_rect);
 
 2944  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 2945    cv::resize(src_subbmap, src_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_CUBIC);
 
 2950  MMechostr(MSKDEBUG, 
"end _BTBLENDbitmaps\n");
 
 
 2970  MMechostr(MSKDEBUG, 
"_BTBLENDalphaBitmaps\n");
 
 2973  int imix = MMpull(m);
 
 2974  int isrcrect = MMpull(m);
 
 2975  int isrcbmap = MMpull(m);
 
 2976  int idstrect = MMpull(m);
 
 2977  int idstbmap = MMget(m, 0);
 
 2979  if (isrcrect == NIL || isrcbmap == NIL || idstrect == NIL || idstbmap == NIL)
 
 2981    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: some arguments are NIL\n");
 
 2990  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 2991  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 2992  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 2993  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 2994  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 2996    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: some dest rect parameters are NIL\n");
 
 3001  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 3002  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 3003  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 3004  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 3005  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 3007    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: some src rect parameters are NIL\n");
 
 3014  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 3015  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 3019  int idstbmap24 = MMfetch(m, MTOP(idstbmap), 0);
 
 3020  int idstbmap8 = MMfetch(m, MTOP(idstbmap), 1);
 
 3021  int isrcbmap24 = MMfetch(m, MTOP(isrcbmap), 0);
 
 3022  int isrcbmap8 = MMfetch(m, MTOP(isrcbmap), 1);
 
 3024  if (idstbmap24 == NIL || idstbmap8 == NIL || isrcbmap24 == NIL || isrcbmap8 == NIL)
 
 3026    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: AlphaBitmaps miscreated or alpha part is missing\n");
 
 3031  PtrObjVoid ptr_dst_bmap = (PtrObjVoid)MMstart(m, MTOP(idstbmap24));
 
 3032  PtrObjVoid ptr_dst_bmap8 = (PtrObjVoid)MMstart(m, MTOP(idstbmap8));
 
 3033  PtrObjVoid ptr_src_bmap = (PtrObjVoid)MMstart(m, MTOP(isrcbmap24));
 
 3034  PtrObjVoid ptr_src_bmap8 = (PtrObjVoid)MMstart(m, MTOP(isrcbmap8));
 
 3036  PtrObjBitmap obj_dst_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap->Buffer));
 
 3037  PtrObjBitmap obj_dst_bmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap8->Buffer));
 
 3038  PtrObjBitmap obj_src_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap->Buffer));
 
 3039  PtrObjBitmap obj_src_bmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap8->Buffer));
 
 3041  if ((obj_dst_bmap->bits == 0) || (obj_src_bmap->bits == 0) || (obj_dst_bmap8->bits == 0) || (obj_src_bmap8->bits == 0))
 
 3043    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: empty alpha channel\n");
 
 3057    MMechostr(MSKRUNTIME, 
"_BTBLENDalphaBitmaps error: src rect size <= 0\n");
 
 3064  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 3065  cv::Mat src_subbmap = src_bmap(src_rect);
 
 3066  cv::Mat dst_subbmap8 = dst_bmap8(dst_rect);
 
 3067  cv::Mat src_subbmap8 = src_bmap8(src_rect);
 
 3070  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 3071    cv::resize(src_subbmap, src_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_CUBIC);
 
 3073  if (src_subbmap8.cols != dst_subbmap8.cols || src_subbmap8.rows != dst_subbmap8.rows)
 
 3074    cv::resize(src_subbmap8, src_subbmap8, dst_subbmap8.size(), 0, 0, cv::INTER_CUBIC);
 
 3079  MMechostr(MSKDEBUG, 
"end _BTBLENDalphaBitmaps\n");
 
 
 3105  MMechostr(MSKDEBUG, 
"_BTBLENDbitmapsBuffer\n");
 
 3108  int imix = MMpull(m);
 
 3109  int isrcrect = MMpull(m);
 
 3111  int isbitsperpixel = MMpull(m);
 
 3112  int isheight = MMpull(m);
 
 3113  int iswidth = MMpull(m);
 
 3114  int isBuff = MMpull(m);
 
 3116  int idstrect = MMpull(m);
 
 3117  int idbitsperpixel = MMpull(m);
 
 3118  int idheight = MMpull(m);
 
 3119  int idwidth = MMpull(m);
 
 3120  int idBuff = MMget(m, 0);
 
 3122  if ((isBuff == NIL) || (iswidth == NIL) || (isheight == NIL) || (isbitsperpixel == NIL) ||
 
 3123      (idBuff == NIL) || (idwidth == NIL) || (idheight == NIL) || (idbitsperpixel == NIL) ||
 
 3124      (imix == NIL) || (isrcrect == NIL) || (idstrect == NIL))
 
 3126    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmapsBuffer error: some arguments are NIL\n");
 
 3131  float mix = MAX(MIN(MTOF(imix), 1.0f), 0.0f);
 
 3133  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 3134  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 3135  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 3136  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 3137  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 3139    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmapsBuffer error: some dest rect parameters are NIL\n");
 
 3144  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 3145  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 3146  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 3147  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 3148  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 3150    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmapsBuffer error: some src rect parameters are NIL\n");
 
 3157  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 3158  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 3162  unsigned char* sbuffer = MMgetPointer<unsigned char*>(m, MTOP(isBuff));
 
 3163  if (sbuffer == NULL)
 
 3169  isbitsperpixel = MTOI(isbitsperpixel);
 
 3170  isheight = MTOI(isheight);
 
 3171  iswidth = MTOI(iswidth);
 
 3174  if (src_bmap.empty())
 
 3180  unsigned char* dbuffer = MMgetPointer<unsigned char*>(m, MTOP(idBuff));
 
 3181  if (dbuffer == NULL)
 
 3187  idbitsperpixel = MTOI(idbitsperpixel);
 
 3188  idheight = MTOI(idheight);
 
 3189  idwidth = MTOI(idwidth);
 
 3192  if (dst_bmap.empty())
 
 3202    MMechostr(MSKRUNTIME, 
"_BTBLENDbitmapsBuffer error: src rect size <= 0\n");
 
 3209  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 3210  cv::Mat src_subbmap = src_bmap(src_rect);
 
 3213  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 3214    cv::resize(src_subbmap, src_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_CUBIC);
 
 3219  MMechostr(MSKDEBUG, 
"end _BTBLENDbitmapsBuffer\n");
 
 
 3238  MMechostr(MSKDEBUG, 
"_BTCPbitmapRect\n");
 
 3241  int isrcrect = MMpull(m);
 
 3242  int isrcbmap = MMpull(m);
 
 3243  int idstrect = MMpull(m);
 
 3244  int idstbmap = MMget(m, 0);
 
 3246  if (isrcrect == NIL || isrcbmap == NIL || idstrect == NIL || idstbmap == NIL)
 
 3248    MMechostr(MSKRUNTIME, 
"_BTCPbitmapRect error: some arguments are NIL\n");
 
 3253  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 3254  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 3255  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 3256  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 3257  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 3259    MMechostr(MSKRUNTIME, 
"_BTCPbitmapRect error: some dest rect parameters are NIL\n");
 
 3264  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 3265  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 3266  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 3267  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 3268  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 3270    MMechostr(MSKRUNTIME, 
"_BTCPbitmapRect error: some src rect parameters are NIL\n");
 
 3277  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 3278  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 3283  PtrObjVoid ptr_dst_bmap = (PtrObjVoid)MMstart(m, MTOP(idstbmap));
 
 3284  PtrObjVoid ptr_src_bmap = (PtrObjVoid)MMstart(m, MTOP(isrcbmap));
 
 3286  PtrObjBitmap obj_dst_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap->Buffer));
 
 3287  PtrObjBitmap obj_src_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap->Buffer));
 
 3289  if ((obj_dst_bmap->bits == 0) || (obj_src_bmap->bits == 0))
 
 3302    MMechostr(MSKRUNTIME, 
"_BTCPbitmapRect error: src rect size <= 0\n");
 
 3309  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 3310  cv::Mat src_subbmap = src_bmap(src_rect);
 
 3313  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 3314    cv::resize(src_subbmap, dst_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_CUBIC);
 
 3316    src_subbmap.copyTo(dst_bmap(dst_rect));
 
 3319  MMechostr(MSKDEBUG, 
"end _BTCPbitmapRect\n");
 
 
 3338  MMechostr(MSKDEBUG, 
"_BTCPalphaBitmapRect\n");
 
 3341  int isrcrect = MMpull(m);
 
 3342  int isrcbmap = MMpull(m);
 
 3343  int idstrect = MMpull(m);
 
 3344  int idstbmap = MMget(m, 0);
 
 3346  if (isrcrect == NIL || isrcbmap == NIL || idstrect == NIL || idstbmap == NIL)
 
 3348    MMechostr(MSKRUNTIME, 
"_BTCPalphaBitmapRect error: some arguments are NIL\n");
 
 3353  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 3354  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 3355  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 3356  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 3357  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 3359    MMechostr(MSKRUNTIME, 
"_BTCPalphaBitmapRect error: some dest rect parameters are NIL\n");
 
 3364  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 3365  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 3366  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 3367  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 3368  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 3370    MMechostr(MSKRUNTIME, 
"_BTCPalphaBitmapRect error: some src rect parameters are NIL\n");
 
 3377  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 3378  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 3382  int idstbmap24 = MMfetch(m, MTOP(idstbmap), 0);
 
 3383  int idstbmap8 = MMfetch(m, MTOP(idstbmap), 1);
 
 3384  int isrcbmap24 = MMfetch(m, MTOP(isrcbmap), 0);
 
 3385  int isrcbmap8 = MMfetch(m, MTOP(isrcbmap), 1);
 
 3387  if ((idstbmap24 == NIL) || (isrcbmap24 == NIL))
 
 3389    MMechostr(MSKRUNTIME, 
"_BTCPalphaBitmapRect error: AlphaBitmaps miscreated\n");
 
 3394  bool hasBmp8 = ((isrcbmap8 != NIL) && (idstbmap8 != NIL)) ? 
true : 
false;
 
 3397  PtrObjVoid ptr_dst_bmap = (PtrObjVoid)MMstart(m, MTOP(idstbmap24));
 
 3398  PtrObjVoid ptr_src_bmap = (PtrObjVoid)MMstart(m, MTOP(isrcbmap24));
 
 3399  PtrObjBitmap obj_dst_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap->Buffer));
 
 3400  PtrObjBitmap obj_src_bmap = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap->Buffer));
 
 3407    MMechostr(MSKRUNTIME, 
"_BTCPalphaBitmapRect error: src rect size <= 0\n");
 
 3414  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 3415  cv::Mat src_subbmap = src_bmap(src_rect);
 
 3418  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 3419    cv::resize(src_subbmap, dst_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_AREA);
 
 3421    src_subbmap.copyTo(dst_bmap(dst_rect));  
 
 3423  PtrObjVoid ptr_dst_bmap8 = (PtrObjVoid)MMstart(m, MTOP(idstbmap8));
 
 3424  PtrObjVoid ptr_src_bmap8 = (PtrObjVoid)MMstart(m, MTOP(isrcbmap8));
 
 3425  PtrObjBitmap obj_dst_bmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_dst_bmap8->Buffer));
 
 3426  PtrObjBitmap obj_src_bmap8 = (PtrObjBitmap)MMstart(m, MTOP(ptr_src_bmap8->Buffer));
 
 3431    if ((obj_dst_bmap8->bits == 0) || (obj_src_bmap8->bits == 0))
 
 3439    cv::Mat dst_subbmap8 = dst_bmap8(dst_rect);
 
 3440    cv::Mat src_subbmap8 = src_bmap8(src_rect);
 
 3443    if (src_subbmap8.cols != dst_subbmap8.cols || src_subbmap8.rows != dst_subbmap8.rows)
 
 3444      cv::resize(src_subbmap8, dst_subbmap8, dst_subbmap8.size(), 0, 0, cv::INTER_AREA);
 
 3446      src_subbmap8.copyTo(dst_bmap8(dst_rect));
 
 3450  MMechostr(MSKDEBUG, 
"end _BTCPalphaBitmapRect\n");
 
 
 3475  MMechostr(MSKDEBUG, 
"_BTCPbitmapBufferRect");
 
 3478  int isrcrect = MMpull(m);
 
 3480  int isbitsperpixel = MMpull(m);
 
 3481  int isheight = MMpull(m);
 
 3482  int iswidth = MMpull(m);
 
 3483  int isBuff = MMpull(m);
 
 3485  int idstrect = MMpull(m);
 
 3486  int idbitsperpixel = MMpull(m);
 
 3487  int idheight = MMpull(m);
 
 3488  int idwidth = MMpull(m);
 
 3489  int idBuff = MMget(m, 0);
 
 3491  if ((isBuff == NIL) || (iswidth == NIL) || (isheight == NIL) || (isbitsperpixel == NIL) ||
 
 3492    (idBuff == NIL) || (idwidth == NIL) || (idheight == NIL) || (idbitsperpixel == NIL) || (isrcrect == NIL) || (idstrect == NIL))
 
 3494    MMechostr(MSKRUNTIME, 
"_BTCPbitmapBufferRect error: some arguments are NIL\n");
 
 3499  int idstrectx = MMfetch(m, MTOP(idstrect), 0);
 
 3500  int idstrecty = MMfetch(m, MTOP(idstrect), 1);
 
 3501  int idstrectw = MMfetch(m, MTOP(idstrect), 2);
 
 3502  int idstrecth = MMfetch(m, MTOP(idstrect), 3);
 
 3503  if (idstrectx == NIL || idstrecty == NIL || idstrectw == NIL || idstrecth == NIL)
 
 3505    MMechostr(MSKRUNTIME, 
"_BTCPbitmapBufferRect error: some dest rect parameters are NIL\n");
 
 3510  int isrcrectx = MMfetch(m, MTOP(isrcrect), 0);
 
 3511  int isrcrecty = MMfetch(m, MTOP(isrcrect), 1);
 
 3512  int isrcrectw = MMfetch(m, MTOP(isrcrect), 2);
 
 3513  int isrcrecth = MMfetch(m, MTOP(isrcrect), 3);
 
 3514  if (isrcrectx == NIL || isrcrecty == NIL || isrcrectw == NIL || isrcrecth == NIL)
 
 3516    MMechostr(MSKRUNTIME, 
"_BTCPbitmapBufferRect error: some src rect parameters are NIL\n");
 
 3523  cv::Rect dst_rect(MTOI(idstrectx), MTOI(idstrecty), MTOI(idstrectw), MTOI(idstrecth));
 
 3524  cv::Rect src_rect(MTOI(isrcrectx), MTOI(isrcrecty), MTOI(isrcrectw), MTOI(isrcrecth));
 
 3528  unsigned char* sbuffer = MMgetPointer<unsigned char*>(m, MTOP(isBuff));
 
 3529  if (sbuffer == NULL)
 
 3535  isbitsperpixel = MTOI(isbitsperpixel);
 
 3536  isheight = MTOI(isheight);
 
 3537  iswidth = MTOI(iswidth);
 
 3540  if (src_bmap.empty())
 
 3546  unsigned char* dbuffer = MMgetPointer<unsigned char*>(m, MTOP(idBuff));
 
 3547  if (dbuffer == NULL)
 
 3553  idbitsperpixel = MTOI(idbitsperpixel);
 
 3554  idheight = MTOI(idheight);
 
 3555  idwidth = MTOI(idwidth);
 
 3558  if (dst_bmap.empty())
 
 3566    MMechostr(MSKRUNTIME, 
"_BTCPbitmapBufferRect error: src rect size <= 0\n");
 
 3573  cv::Mat dst_subbmap = dst_bmap(dst_rect);
 
 3574  cv::Mat src_subbmap = src_bmap(src_rect);
 
 3576  if (idbitsperpixel != isbitsperpixel)
 
 3578    if ((idbitsperpixel == 3) && (isbitsperpixel == 4))
 
 3579      cv::cvtColor(src_subbmap, src_subbmap, cv::COLOR_RGBA2RGB);
 
 3580    else if ((idbitsperpixel == 4) && (isbitsperpixel == 3))
 
 3581      cv::cvtColor(src_subbmap, src_subbmap, cv::COLOR_RGB2RGBA);
 
 3582    else if ((idbitsperpixel == 1) && (isbitsperpixel == 3))
 
 3583      cv::cvtColor(src_subbmap, src_subbmap, cv::COLOR_RGB2GRAY);
 
 3584    else if ((idbitsperpixel == 1) && (isbitsperpixel == 4))
 
 3585      cv::cvtColor(src_subbmap, src_subbmap, cv::COLOR_RGBA2GRAY);
 
 3589  if (src_subbmap.cols != dst_subbmap.cols || src_subbmap.rows != dst_subbmap.rows)
 
 3590    cv::resize(src_subbmap, dst_subbmap, dst_subbmap.size(), 0, 0, cv::INTER_CUBIC);
 
 3592    src_subbmap.copyTo(dst_bmap(dst_rect));
 
 3595  MMechostr(MSKDEBUG, 
"end _BTCPbitmapBufferRect\n");
 
 
 3618  MMechostr(MSKDEBUG, 
"_BTGETbitmapBuffer\n");
 
 3622  int bitmap = MMget(m, 0);
 
 3630  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
 3631  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
 3640  if ((MMpushPointer(m, B->bits) != 0))
 
 3647  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 3670  MMechostr(MSKDEBUG, 
"_BTGETbitmapBufferExt\n");
 
 3674  int bitmap = MMget(m, 0);
 
 3682  PtrObjVoid OB = (PtrObjVoid)MMstart(m, MTOP(bitmap));
 
 3683  PtrObjBitmap B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
 
 3692  if ((MMpushPointer(m, B->bits) != 0))
 
 3698  MMpush(m, ITOM(B->TailleW));
 
 3699  MMpush(m, ITOM(B->TailleH));
 
 3700  MMpush(m, ITOM(B->BytesPP));
 
 3705  MMechostr(MSKDEBUG, 
"ok\n");
 
 
 3718  { 
"_BTBLURbitmap", 3, 
"fun [ObjBitmap I I] ObjBitmap", 
_BTBLURbitmap },
 
 3719  { 
"_BTBLURbitmap8", 3, 
"fun [ObjBitmap8 I I] ObjBitmap8", 
_BTBLURbitmap },
 
 3722  { 
"_BTFILTERbitmap", 2, 
"fun [ObjBitmap tab tab F] ObjBitmap", 
_BTFILTERbitmap },
 
 3723  { 
"_BTFILTERbitmap8", 2, 
"fun [ObjBitmap8 tab tab F] ObjBitmap8", 
_BTFILTERbitmap },
 
 3730  { 
"_BTLAPLACEbitmap", 3, 
"fun [ObjBitmap I I] ObjBitmap", 
_BTLAPLACEbitmap },
 
 3731  { 
"_BTLAPLACEbitmap8", 3, 
"fun [ObjBitmap8 I I] ObjBitmap8", 
_BTLAPLACEbitmap },
 
 3734  { 
"_BTFLIPbitmap", 1, 
"fun [ObjBitmap] ObjBitmap", 
_BTFLIPbitmap },
 
 3735  { 
"_BTFLIPbitmap8", 1, 
"fun [ObjBitmap8] ObjBitmap8", 
_BTFLIPbitmap },
 
 3736  { 
"_BTFLIPbuffer", 4, 
"fun [ObjBuff I I I] ObjBuff", 
_BTFLIPbuffer },
 
 3738  { 
"_BTNORMALbitmap", 3, 
"fun [ObjBitmap F F] ObjBitmap", 
_BTNORMALbitmap },
 
 3741  { 
"_BTDRAWcircle", 5, 
"fun [ObjBitmap [I I] I I I I I] ObjBitmap", 
_BTDRAWcircle },
 
 3742  { 
"_BTDRAWcircle8", 5, 
"fun [ObjBitmap8 [I I] I I I I I] ObjBitmap8", 
_BTDRAWcircle },
 
 3743  { 
"_BTDRAWcircleBuffer", 8, 
"fun [ObjBuff I I I [I I] I I I I I] ObjBuff", 
_BTDRAWcircleBuffer },
 
 3745  { 
"_BTDRAWrect", 6, 
"fun [ObjBitmap [I I I I] I I I I] ObjBitmap", 
_BTDRAWrect },
 
 3746  { 
"_BTDRAWrect8", 6, 
"fun [ObjBitmap8 [I I I I] I I I I] ObjBitmap8", 
_BTDRAWrect },
 
 3747  { 
"_BTDRAWrectBuffer", 9, 
"fun [ObjBuff I I I [I I I I] I I I I] ObjBuff", 
_BTDRAWrectBuffer },
 
 3749  { 
"_BTDRAWline", 5, 
"fun [ObjBitmap [I I] [I I] I I] ObjBitmap", 
_BTDRAWline },
 
 3750  { 
"_BTDRAWline8", 5, 
"fun [ObjBitmap8 [I I] [I I] I I] ObjBitmap8", 
_BTDRAWline },
 
 3751  { 
"_BTDRAWlineBuffer", 8, 
"fun [ObjBuff I I I [I I] [I I] I I] ObjBuff", 
_BTDRAWlineBuffer },
 
 3753  { 
"_BTDRAWpath", 4, 
"fun [ObjBitmap [[I I] r1] I I] ObjBitmap", 
_BTDRAWpath },
 
 3754  { 
"_BTDRAWpath8", 4, 
"fun [ObjBitmap8 [[I I] r1] I I] ObjBitmap8", 
_BTDRAWpath },
 
 3755  { 
"_BTDRAWpathBuffer", 7, 
"fun [ObjBuff I I I [[I I] r1] I I] ObjBuff", 
_BTDRAWpathBuffer },
 
 3757  { 
"_BTCompBitmap", 2, 
"fun [ObjBitmap I] S", 
_BTCompBitmap },
 
 3758  { 
"_BTUnCompBitmap", 2, 
"fun [S ObjBitmap] ObjBitmap", 
_BTUnCompBitmap },
 
 3760  { 
"_BTMOTIONdetect", 4, 
"fun [ObjBitmap ObjBitmap I I] I", 
_BTMOTIONdetect },
 
 3762  { 
"_BTSCALEbitmap", 3, 
"fun [ObjBitmap ObjBitmap I] ObjBitmap", 
_BTSCALEbitmap },
 
 3763  { 
"_BTSCALEalphaBitmap", 3, 
"fun [AlphaBitmap AlphaBitmap I] AlphaBitmap", 
_BTSCALEalphaBitmap },
 
 3764  { 
"_BTSCALEbitmap8", 3, 
"fun [ObjBitmap8 ObjBitmap8 I] ObjBitmap8", 
_BTSCALEbitmap },
 
 3765  { 
"_BTSCALEbitmapBuffer", 9, 
"fun [ObjBuff I I I ObjBuff I I I I] ObjBuff", 
_BTSCALEbitmapBuffer },
 
 3767  { 
"_BTSAVEbitmap", 2, 
"fun [ObjBitmap W] P", 
_BTSAVEbitmap },
 
 3768  { 
"_BTSAVEbitmap8", 2, 
"fun [ObjBitmap8 W] P", 
_BTSAVEbitmap },
 
 3771  { 
"_BTLOADbitmap", 2, 
"fun [Chn P] ObjBitmap", 
_BTLOADbitmap },
 
 3773  { 
"_BTBLENDbitmaps", 5, 
"fun [ObjBitmap [I I I I] ObjBitmap [I I I I] F] ObjBitmap", 
_BTBLENDbitmaps },
 
 3774  { 
"_BTBLENDbitmaps8", 5, 
"fun [ObjBitmap8 [I I I I] ObjBitmap8 [I I I I] F] ObjBitmap8", 
_BTBLENDbitmaps },
 
 3775  { 
"_BTBLENDalphaBitmaps", 5, 
"fun [AlphaBitmap [I I I I] AlphaBitmap [I I I I] F] AlphaBitmap", 
_BTBLENDalphaBitmaps },
 
 3776  { 
"_BTBLENDbitmapsBuffer", 11, 
"fun [ObjBuff I I I [I I I I] ObjBuff I I I [I I I I] F] ObjBuff", 
_BTBLENDbitmapsBuffer },
 
 3778  { 
"_BTCPbitmapRect", 4, 
"fun [ObjBitmap [I I I I] ObjBitmap [I I I I]] ObjBitmap", 
_BTCPbitmapRect },
 
 3779  { 
"_BTCPbitmapRect8", 4, 
"fun [ObjBitmap8 [I I I I] ObjBitmap8 [I I I I]] ObjBitmap8", 
_BTCPbitmapRect },
 
 3780  { 
"_BTCPalphaBitmapRect", 4, 
"fun [AlphaBitmap [I I I I] AlphaBitmap [I I I I]] AlphaBitmap", 
_BTCPalphaBitmapRect },
 
 3781  { 
"_BTCPbitmapBufferRect", 10, 
"fun [ObjBuff I I I [I I I I] ObjBuff I I I [I I I I]] ObjBuff", 
_BTCPbitmapBufferRect },
 
 3789  { 
"ObjBTMat", TYPTYPE, NULL, NULL },
 
 3790  { 
"_CRBTmat", 2, 
"fun [Chn AlphaBitmap] ObjBTMat", 
_CRBTmat },
 
 3791  { 
"_DSBTmat", 1, 
"fun [ObjBTMat] I", 
_DSBTmat },
 
 3794  { 
"ObjBTFont", TYPTYPE, NULL, NULL },
 
 3795  { 
"_CRBTfont", 5, 
"fun [Chn S I I F] ObjBTFont", 
_CRBTfont },
 
 3797  { 
"_DSBTfont", 1, 
"fun [ObjBTFont] I", 
_DSBTfont },
 
 3799  { 
"BT_FONT_BOLD", TYPVAR, 
"I", SCOL_TYPTYPE(
BT_FONT_BOLD) },
 
 3804  { 
"BT_FONT_SANS", TYPVAR, 
"I", SCOL_TYPTYPE(
BT_FONT_SANS) },
 
 3805  { 
"BT_FONT_SERIF", TYPVAR, 
"I", SCOL_TYPTYPE(
BT_FONT_SERIF) },
 
 3818  { 
"_BTDRAWtextBitmap", 6, 
"fun [ObjBitmap ObjBTFont [I I] I I S] ObjBitmap", 
_BTDRAWtextBitmap },
 
 3819  { 
"_BTDRAWtextBitmap8", 6, 
"fun [ObjBitmap8 ObjBTFont [I I] I I S] ObjBitmap8", 
_BTDRAWtextBitmap },
 
 3820  { 
"_BTDRAWtextAreaBitmap", 7, 
"fun [ObjBitmap ObjBTFont [I I I I] [I I] I I S] ObjBitmap", 
_BTDRAWtextAreaBitmap },
 
 3821  { 
"_BTDRAWtextAreaBitmap8", 7, 
"fun [ObjBitmap8 ObjBTFont [I I I I] [I I] I I S] ObjBitmap8", 
_BTDRAWtextAreaBitmap },
 
 3822  { 
"_BTDRAWtextAlphaBitmap", 7, 
"fun [AlphaBitmap ObjBTFont [I I] I I I S] AlphaBitmap", 
_BTDRAWtextAlphaBitmap },
 
 3823  { 
"_BTDRAWtextAreaAlphaBitmap", 8, 
"fun [AlphaBitmap ObjBTFont [I I I I] [I I] I I I S] AlphaBitmap", 
_BTDRAWtextAreaAlphaBitmap },
 
 3824  { 
"_BTGETtextSize", 2, 
"fun [ObjBTFont S] [I I]", 
_BTGETtextSize },
 
 
 3839  MMechostr(MSKDEBUG, 
" > Loading BitmapToolkit\n");
 
 3843  MMechostr(MSKDEBUG, 
" > Successfully Loaded\n\n");
 
#define BT_TEXT_HORIZ_LEFT
 
#define BT_TEXT_HORIZ_RIGHT
 
#define BT_TEXT_VERT_MASK
 
#define BT_TEXT_VERT_CENTER
 
#define BT_TEXT_HORIZ_JUSTIFIED
 
#define BT_FONT_ANTIALIAS
 
#define BT_TEXT_HORIZ_CENTERED
 
#define BT_TEXT_VERT_BOTTOM
 
#define BT_TEXT_HORIZ_MASK
 
#define BT_TEXT_WORD_WRAP
 
int destroyCVFont(mmachine m, SCOL_PTR_TYPE handsys, int obj)
 
int LoadBitmapToolKit(mmachine m)
 
int _BTSCALEalphaBitmap(mmachine m)
_BTSCALEalphaBitmap : This function scale an alpha bitmap to an another alpha bitmap Prototype: fun [...
 
int _BTDRAWrectBuffer(mmachine m)
_BTDRAWrectBuffer : This function draw a rectangle into a bitmap buffer Prototype: fun [ObjBuff I I I...
 
int _BTBLENDbitmapsBuffer(mmachine m)
_BTBLENDbitmapsBuffer : blends 2 bitmaps buffer from percentage value. Takes a piece of the src to bl...
 
int _BTFILTERbitmap(mmachine m)
_BTFILTERbitmap : This function apply a kernel filter on a bitmap Prototype: fun [ObjBitmap tab tab F...
 
int _BTMOTIONdetect(mmachine m)
_BTMOTIONdetect : This function detect the motion between two bitmaps Prototype: fun [ObjBitmap ObjBi...
 
int _BTSAVEalphaBitmap(mmachine m)
_BTSAVEbitmapWithAlpha : This function saves a scol RGB bitmap with alpha bitmap to a defined path....
 
int _BTGETbitmapBuffer(mmachine m)
_BTGETbitmapBuffer : This function return the bitmap buffer Prototype: fun [ObjBitmap] ObjBuff
 
int _BTDRAWcircle(mmachine m)
_BTDRAWcircle : This function draw a circle into a bitmap Prototype: fun [ObjBitmap [I I] I I I I I] ...
 
int _BTLOADbitmap(mmachine m)
_BTLOADbitmap : This function loads an RGB bitmap from a defined path. Prototype: fun [Chn P] ObjBitm...
 
int _BTSCALEbitmap(mmachine m)
_BTSCALEbitmap : This function scale a bitmap to an another bitmap Prototype: fun [ObjBitmap ObjBitma...
 
int _BTBRIGHTNESSbitmap(mmachine m)
_BTBRIGHTNESSbitmap : This function change the brightness of a bitmap Prototype: fun [ObjBitmap I] Ob...
 
int _BTGETmatBuffer(mmachine m)
_BTGETmatBuffer : Get a cv mat buffer Prototype: fun [ObjBTMat] ObjBuff
 
int _BTFLIPbuffer(mmachine m)
_BTFLIPbuffer : This function apply vertical flip on a pixel buffer Prototype: fun [ObjBuff I I I] Ob...
 
int _BTBLURbitmap(mmachine m)
_BTBLURbitmap : This function apply a blur on a bitmap Prototype: fun [ObjBitmap I I] ObjBitmap
 
int _BTBLENDalphaBitmaps(mmachine m)
_BTBLENDalphaBitmaps : blends 2 alpha bitmaps. Takes a piece of the src to blit it in a piece of the ...
 
int _BTNORMALbitmapBuffer(mmachine m)
_BTNORMALbitmapBuffer :This function convert an height map to a normal map bitmap Prototype: fun [Obj...
 
int _BTSCALEbitmapBuffer(mmachine m)
_BTSCALEbitmapBuffer : This function scale a bitmap to an another bitmap Prototype: fun [ObjBuff I I ...
 
int _BTGETbitmapBufferExt(mmachine m)
_BTGETbitmapBufferExt : This function return the bitmap buffer Prototype: fun [ObjBitmap] [ObjBuff I ...
 
int _BTFLIPbitmap(mmachine m)
_BTFLIPbitmap : This function apply vertical flip on a bitmap Prototype: fun [ObjBitmap] ObjBitmap
 
int _BTCompBitmap(mmachine m)
_BTCompBitmap : This function compress a bitmap and return the buffer as string Prototype: fun [ObjBi...
 
int _BTDRAWpathBuffer(mmachine m)
_BTDRAWpathBuffer : This function draw a line into a bitmap buffer Prototype: fun [ObjBuff I I I [[I ...
 
int _DSBTmat(mmachine m)
_DSBTmat : Deletes a cv mat object Prototype: fun [ObjBTMat] I
 
int _BTBLENDbitmaps(mmachine m)
_BTBLENDbitmaps : blends 2 bitmaps from percentage value. Takes a piece of the src to blit it in a pi...
 
int _BTDRAWpath(mmachine m)
_BTDRAWpath : This function draw a path into a bitmap Prototype: fun [ObjBitmap [[I I] r1] I I] ObjBi...
 
int _BTLAPLACEbitmapBuffer(mmachine m)
_BTLAPLACEbitmapBuffer : This function apply LAPLACE filter on a bitmap buffer Prototype: fun [ObjBuf...
 
int _BTCPalphaBitmapRect(mmachine m)
_BTCPalphaBitmapRect : copy a bitmap buffer rect to another. Takes a piece of the src to blit it in a...
 
int _BTSAVEbitmap(mmachine m)
_BTSAVEbitmap : This function saves a scol RGB bitmap to a defined path. The format is defined by the...
 
int _BTUnCompBitmap(mmachine m)
_BTUnCompBitmap : This function uncompress a bitmap data to an existed bitmap Prototype: fun [S ObjBi...
 
int _BTDRAWrect(mmachine m)
_BTDRAWrect : This function draw a rectangle into a bitmap Prototype: fun [ObjBitmap [I I I I] I I I ...
 
int _BTDRAWline(mmachine m)
_BTDRAWline : This function draw a line into a bitmap Prototype: fun [ObjBitmap [I I] [I I] I I] ObjB...
 
int _BTBLURbitmapBuffer(mmachine m)
_BTBLURbitmapBuffer : This function apply a blur on a bitmap buffer Prototype: fun [ObjBuff I I I I I...
 
int _BTDRAWlineBuffer(mmachine m)
_BTDRAWlineBuffer : This function draw a line into a bitmap buffer Prototype: fun [ObjBuff I I I [I I...
 
int _BTLAPLACEbitmap(mmachine m)
_BTLAPLACEbitmap : This function apply a LAPLACE filter on a bitmap Prototype: fun [ObjBitmap I I] Ob...
 
int _BTCPbitmapBufferRect(mmachine m)
_BTCPbitmapBufferRect : copy a bitmap buffer rect to another. Takes a piece of the src to blit it in ...
 
int _BTDRAWcircleBuffer(mmachine m)
_BTDRAWcircleBuffer : This function draw a circle into a bitmap buffer Prototype: fun [ObjBuff I I I ...
 
int _CRBTmat(mmachine m)
_CRBTmat : Creates a ObjBTMat object from an AlphaBitmap Prototype: fun [Chn AlphaBitmap] ObjBTMat
 
int _BTFILTERbitmapBuffer(mmachine m)
_BTFILTERbitmapBuffer : This function apply a kernel filter on a bitmap buffer Prototype: fun [ObjBuf...
 
int _BTNORMALbitmap(mmachine m)
_BTNORMALbitmap : This function convert an height map to a normal map bitmap Prototype: fun [ObjBitma...
 
int _BTCPbitmapRect(mmachine m)
_BTCPbitmapRect : copy a bitmap buffer rect to another. Takes a piece of the src to blit it in a piec...
 
int _BTBRIGHTNESSbitmapBuffer(mmachine m)
_BTBRIGHTNESSbitmapBuffer : This function change the brightness of a bitmap buffer Prototype: fun [Ob...
 
int _CRBTfont(mmachine m)
_CRBTfont : Creates a ObjBTFont object Prototype: fun [Chn S I I F] ObjBTFont
 
int _CRBTfontFromFile(mmachine m)
_CRBTfontFromFile : Creates a ObjBTFont object Prototype: fun [Chn P I I F] ObjBTFont
 
int _BTDRAWtextAlphaBitmap(mmachine m)
_BTDRAWtextAlphaBitmap : Draws a text to a bitmap Prototype: fun [AlphaBitmap ObjBTFont [I I] I I I S...
 
int _BTDRAWtextAreaAlphaBitmap(mmachine m)
_BTDRAWtextAreaAlphaBitmap : Draws a text to an alpha bitmap, within a defined area Prototype: fun [A...
 
int _BTDRAWtextBitmap(mmachine m)
_BTDRAWtextBitmap : Draws a text to a bitmap Prototype: fun [ObjBitmap S ObjBTFont [I I] I I] ObjBitm...
 
int _BTGETtextSize(mmachine m)
_BTGETtextSize : Gets the length of a text line Prototype: fun [ObjBTFont S] [I I]
 
int _BTGETtextAreaHeight(mmachine m)
_BTGETtextAreaHeight : Gets the height of a formated text area Prototype: fun [ObjBTFont S I I] I
 
int _DSBTfont(mmachine m)
_DSBTfont : Deletes a cv font object Prototype: fun [ObjBTFont] I
 
int _BTDRAWtextAreaBitmap(mmachine m)
_BTDRAWtextAreaBitmap : Draws a text to a bitmap, within a defined area Prototype: fun [ObjBitmap Obj...