if (startAngle < 0) startAngle = -startAngle;
void Java_vdr_mhp_awt_MHPNativeGraphics_drawLine(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x1, jint y1, jint x2, jint y2) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   try {      //printf("DrawLine\n");      surface->SetDrawingFlags(DSDRAW_BLEND);      surface->DrawLine(x1, y1, x2, y2);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x1 <? x2, y1 <? y2, x1 >? x2, y1 >? y2);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawOval(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height) {   //draw a 360* arc   Java_vdr_mhp_awt_MHPNativeGraphics_drawArc(env, obj, nativeData, nativeFlipData, x, y, width, height, 0, 360);}static void drawPoly(JNIEnv* env, jlong nativeData, jlong nativeFlipData, jintArray xPoints, jintArray yPoints, jint nPoints, bool closed) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   int xmax=0, xmin, ymax=0, ymin;      jint *xs=env->GetIntArrayElements(xPoints, 0);   jint *ys=env->GetIntArrayElements(yPoints, 0);   if (!xs || !ys || nPoints!=(jint)env->GetArrayLength(xPoints) || nPoints!=(jint)env->GetArrayLength(yPoints))      return;      for (int i=1;i<nPoints;i++) {      xmin = xmin <? xs[i];      ymin = ymin <? ys[i];      xmax = xmax >? xs[i];      ymax = ymax >? ys[i];   }      try {      surface->GetSize(&xmin, &ymin);      surface->SetDrawingFlags(DSDRAW_BLEND);                  for (int i=1;i<nPoints;i++) {         surface->DrawLine(xs[i-1], ys[i-1], xs[i], ys[i]);      }            if (closed)         surface->DrawLine(xs[nPoints-1], ys[nPoints-1], xs[0], ys[0]);         } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      env->ReleaseIntArrayElements(xPoints, xs, JNI_ABORT);      env->ReleaseIntArrayElements(yPoints, ys, JNI_ABORT);      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(xmin, ymin, xmax, ymax);      env->ReleaseIntArrayElements(xPoints, xs, JNI_ABORT);   env->ReleaseIntArrayElements(yPoints, ys, JNI_ABORT);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawPolygon(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jintArray xPoints, jintArray yPoints, jint nPoints) {   drawPoly(env, nativeData, nativeFlipData, xPoints, yPoints, nPoints, true);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawPolyline(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jintArray xPoints, jintArray yPoints, jint nPoints) {   drawPoly(env, nativeData, nativeFlipData, xPoints, yPoints, nPoints, false);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawRect(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   try {      surface->SetDrawingFlags(DSDRAW_BLEND);      surface->DrawRectangle(x, y, width+1, height+1);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width, y+height);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawRoundRect(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height, jint arcWidth, jint arcHeight) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   //printf("Java_vdr_mhp_awt_MHPNativeGraphics_fillRoundRect: %dx%d, %dx%d\n", x, y, width, height);      if (width<=0 || height<=0 || arcWidth<0 || arcHeight<0)      return;   if (x<0)      x=0;   if (y<0)      y=0;   if (height<arcHeight || width<arcWidth)      return Java_vdr_mhp_awt_MHPNativeGraphics_drawRect(env, obj, nativeData, nativeFlipData, x,y,width, height);      //libxmi operations   miPixel pixels[2];   miGC *pGC;   miPaintedSet *paintedSet;   miEllipseCache *cache;   miArc arcs[4];      pixels[0]=0; // pixel value for `off' dashes, if drawn   pixels[1]=1; // default pixel for drawing   pGC = miNewGC(2, pixels);   paintedSet = miNewPaintedSet();   cache = miNewEllipseCache();      //upper left corner   arcs[0].x=x;   arcs[0].y=y;   arcs[0].width=arcWidth;   arcs[0].height=arcHeight;   arcs[0].angle1=90*64; //starting angle, in 1/64 degrees, counterclockwise from x-axis   arcs[0].angle2=90*64; //angle range, in 1/64 degrees      //lower left   arcs[1].x=x;   arcs[1].y=y+height-arcHeight;   arcs[1].width=arcWidth;   arcs[1].height=arcHeight;   arcs[1].angle1=180*64;   arcs[1].angle2=90*64;      //uper right   arcs[2].x=x+width-arcWidth;   arcs[2].y=y;   arcs[2].width=arcWidth;   arcs[2].height=arcHeight;   arcs[2].angle1=0*64;   arcs[2].angle2=90*64;      //lower right   arcs[3].x=x+width-arcWidth;   arcs[3].y=y+height-arcHeight;   arcs[3].width=arcWidth;   arcs[3].height=arcHeight;   arcs[3].angle1=0*64;   arcs[3].angle2=-90*64;      miDrawArcs_r(paintedSet, pGC, 4, arcs, cache);     miDeleteEllipseCache(cache);      //do the actual drawing   try {      surface->SetDrawingFlags(DSDRAW_BLEND);            //first draw four normal lines (the corners cut out):      //left      if ((y+height-arcHeight/2)>0)         surface->DrawLine(x, y+arcHeight/2, x, y+height-arcHeight/2);      //upper      if ((x+width-arcWidth/2)>0)         surface->DrawLine(x+arcWidth/2, y, x+width-arcWidth/2, y);      //right      if ((y+height-arcHeight/2)>0)         surface->DrawLine(x+width, y+arcHeight/2, x+width, y+height-arcHeight/2);       //lower      if ((x+width-arcWidth/2)>0)         surface->DrawLine(x+arcWidth/2, y+height, x+width-arcWidth/2, y+height);            //now translate the point structures of the paintedSet to the surface's pixels, i.e., draw the arcs      for (int i = 0; i < paintedSet->ngroups; i++) {         if (paintedSet->groups[i]->group[0].count > 0) {            if (paintedSet->groups[i]->pixel) {               for (int u=0;u<paintedSet->groups[i]->group[0].count;u++) {                                 surface->DrawLine(paintedSet->groups[i]->group[0].points[u].x,                                    paintedSet->groups[i]->group[0].points[u].y,                                    paintedSet->groups[i]->group[0].points[u].x + paintedSet->groups[i]->group[0].widths[u],                                    paintedSet->groups[i]->group[0].points[u].y);               }            }         }      }         } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      miDeleteGC (pGC);      miDeletePaintedSet (paintedSet);      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width+1, y+height+1);   miDeleteGC (pGC);   miDeletePaintedSet (paintedSet);}void Java_vdr_mhp_awt_MHPNativeGraphics_drawString(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jstring s, jint x, jint y) {   const char *str=(const char *)env->GetStringUTFChars(s, NULL);   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   IDirectFBFont *font;   try {      font=surface->GetFont();            surface->SetDrawingFlags(DSDRAW_BLEND);            int length=env->GetStringUTFLength(s);      int width=font->GetStringWidth(str, length);      int descender=font->GetDescender();      int ascender=font->GetAscender();              surface->DrawString(str, length, x, y, DSTF_LEFT);       //printf("Graphics: DrawString with length %d, area is %dx%d-%dx%d because a %d, d %d, w %d\n", length, x, y-ascender, x+width, y-descender, ascender, descender, width);      //descender is a negative value, so y-descender > y > y-ascender      ((FlipData *)nativeFlipData)->addUpdate(x, y-ascender, x+width, y-descender);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;   }   env->ReleaseStringUTFChars(s, str);}void Java_vdr_mhp_awt_MHPNativeGraphics_fill3DRect(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData,          jint x, jint y, jint width, jint height, jboolean raised, jint origColor, jint bright, jint dark) {   int color = raised ? bright : dark;   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   try {     setSurfaceColor(surface, color);     surface->SetDrawingFlags(DSDRAW_BLEND);     surface->DrawLine(x, y, x+width-1, y );          surface->DrawLine(x, y+1, x, y+height-0 );     color = raised ? dark : bright;     setSurfaceColor(surface, color);     surface->DrawLine(x+1, y+height-0, x+width-0, y+height-0 );     surface->DrawLine(x+width-0, y, x+width-0, y+height-1 );     surface->FillRectangle(x+1, y+1, width-2, height-2 );          setSurfaceColor(surface, origColor);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width-0, y+height-0);   }void Java_vdr_mhp_awt_MHPNativeGraphics_fillArc(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height, jint startAngle, jint arcAngle) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   //printf("Java_vdr_mhp_awt_MHPNativeGraphics_fillRoundRect: %dx%d, %dx%d\n", x, y, width, height);      if (width<=0 || height<=0 || width<0 || height<0)      return;   if (x<0)      x=0;   if (y<0)      y=0;   if (arcAngle==0) //negative values are okay      return;   if (startAngle < 0)      startAngle = -startAngle;   if (startAngle > 360)      startAngle = startAngle%360;         //libxmi operations   miPixel pixels[2];   miGC *pGC;   miPaintedSet *paintedSet;   //miEllipseCache *cache;   miArc arcs[1];      pixels[0]=0; // pixel value for `off' dashes, if drawn   pixels[1]=1; // default pixel for drawing   pGC = miNewGC(2, pixels);   paintedSet = miNewPaintedSet();   //cache = miNewEllipseCache();      arcs[0].x=x;   arcs[0].y=y;   arcs[0].width=width;   arcs[0].height=height;   arcs[0].angle1=startAngle*64; //starting angle, in 1/64 degrees, counterclockwise from x-axis   arcs[0].angle2=arcAngle*64; //angle range, in 1/64 degrees         miFillArcs(paintedSet, pGC, 1, arcs);     //miDeleteEllipseCache(cache);      //do the actual drawing   try {      surface->SetDrawingFlags(DSDRAW_BLEND);            //translate the point structures of the paintedSet to the surface's pixels      for (int i = 0; i < paintedSet->ngroups; i++) {         if (paintedSet->groups[i]->group[0].count > 0) {            if (paintedSet->groups[i]->pixel) {               for (int u=0;u<paintedSet->groups[i]->group[0].count;u++) {                                 surface->DrawLine(paintedSet->groups[i]->group[0].points[u].x,                                    paintedSet->groups[i]->group[0].points[u].y,                                    paintedSet->groups[i]->group[0].points[u].x + paintedSet->groups[i]->group[0].widths[u],                                    paintedSet->groups[i]->group[0].points[u].y);               }            }         }      }         } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      miDeleteGC (pGC);      miDeletePaintedSet (paintedSet);      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width+1, y+height+1);   miDeleteGC (pGC);   miDeletePaintedSet (paintedSet);}void Java_vdr_mhp_awt_MHPNativeGraphics_fillOval(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   try {     surface->SetDrawingFlags(DSDRAW_BLEND);          int local_x=x, local_y=y;     int xx, yy, x_center, y_center, line_length;      float a, b, d1, d2;     a = width/2;     b = height/2;     x_center = local_x + (int)a;     y_center = local_y + (int)b;     xx = 0;     yy = (int)b;     d1 = b*b - a*a*b + a*a/4;     surface->DrawLine(              (int)(x_center+0.5),                                      (int)(y_center+0.5-yy),                                     (int)(x_center+0.5),                                     (int)(y_center+0.5-yy)+height);     while ( (a*a*(yy-0.5)) > (b*b*(xx+1)) ) {          if (d1 < 0) {               d1 = d1 + b*b*(2*xx+3);               xx++;          }          else {               d1 = d1 + b*b*(2*xx+3)+a*a*(2-2*yy);               xx++;               yy--;          }          line_length = (int)(y_center+0.5+yy) - (int)(y_center+0.5-yy);          surface->DrawLine(              (int)(x_center+0.5+xx),                                           (int)(y_center+0.5-yy),                                          (int)(x_center+0.5+xx),                                          (int)(y_center+0.5-yy)+line_length);                                                    surface->DrawLine(              (int)(x_center+0.5-xx),                                           (int)(y_center+0.5-yy),                                          (int)(x_center+0.5-xx),                                          (int)(y_center+0.5-yy)+line_length);     }     d2=b*b*(xx+0.5)*(xx+0.5)+a*a*(yy-1)*(yy-1)-a*a*b*b;     while (yy>0) {          if (d2<0) {               d2=d2+b*b*(2*xx+2)+a*a*(3-2*yy);               xx++;               yy--;               line_length = (int)(y_center+0.5+yy) - (int)(y_center+0.5-yy);               surface->DrawLine(              (int)(x_center+0.5+xx),                                                (int)(y_center+0.5-yy),                                               (int)(x_center+0.5+xx),                                               (int)(y_center+0.5-yy)+line_length);                                                              surface->DrawLine(              (int)(x_center+0.5-xx),                                                (int)(y_center+0.5-yy),                                               (int)(x_center+0.5-xx),                                               (int)(y_center+0.5-yy)+line_length);          }          else {               d2=d2+a*a*(3-2*yy);               yy--;          }     }   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width-1, y+height-1 );}void Java_vdr_mhp_awt_MHPNativeGraphics_fillPolygon(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jintArray xPoints, jintArray yPoints, jint nPoints) {   //printf("Java_vdr_mhp_awt_MHPNativeGraphics_fillPolygon\n");   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   int xmax=0, xmin, ymax=0, ymin;      jint *xs=env->GetIntArrayElements(xPoints, 0);   jint *ys=env->GetIntArrayElements(yPoints, 0);   if (!xs || !ys || nPoints!=(jint)env->GetArrayLength(xPoints) || nPoints!=(jint)env->GetArrayLength(yPoints))      return;         //libxmi operations   miPixel pixels[2];   miGC *pGC;   miPaintedSet *paintedSet;      pixels[0]=0; // pixel value for `off' dashes, if drawn   pixels[1]=1; // default pixel for drawing   pGC = miNewGC(2, pixels);   paintedSet = miNewPaintedSet();      //transscribe points to XMI structures   miPoint *points=new miPoint[nPoints];   for (int i=0;i<nPoints;i++) {      points[i].x=xs[i];      points[i].y=ys[i];   }      //do the actual drawing   miFillPolygon(paintedSet, pGC, MI_SHAPE_GENERAL, MI_COORD_MODE_ORIGIN, nPoints, points);      try {      surface->SetDrawingFlags(DSDRAW_BLEND);      surface->GetSize(&xmin, &ymin);                     //now translate the point structures of the paintedSet to the surface's pixels        for (int i = 0; i < paintedSet->ngroups; i++) {         if (paintedSet->groups[i]->group[0].count > 0) {            if (paintedSet->groups[i]->pixel) {               for (int u=0;u<paintedSet->groups[i]->group[0].count;u++) {                                 surface->DrawLine(paintedSet->groups[i]->group[0].points[u].x,                                    paintedSet->groups[i]->group[0].points[u].y,                                    paintedSet->groups[i]->group[0].points[u].x + paintedSet->groups[i]->group[0].widths[u],                                    paintedSet->groups[i]->group[0].points[u].y);                                                      xmin = xmin <? paintedSet->groups[i]->group[0].points[u].x;                  ymin = ymin <? paintedSet->groups[i]->group[0].points[u].y;                  xmax = xmax >? paintedSet->groups[i]->group[0].points[u].x + (int)paintedSet->groups[i]->group[0].widths[u];                  ymax = ymax >? paintedSet->groups[i]->group[0].points[u].y;               }            }         }      }                              } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      miDeleteGC (pGC);      miDeletePaintedSet (paintedSet);      delete points;      env->ReleaseIntArrayElements(xPoints, xs, JNI_ABORT);      env->ReleaseIntArrayElements(yPoints, ys, JNI_ABORT);      delete e;      return;   }      ((FlipData *)nativeFlipData)->addUpdate(xmin, ymin, xmax, ymax);      miDeleteGC (pGC);   miDeletePaintedSet (paintedSet);   delete points;   env->ReleaseIntArrayElements(xPoints, xs, JNI_ABORT);   env->ReleaseIntArrayElements(yPoints, ys, JNI_ABORT);}void Java_vdr_mhp_awt_MHPNativeGraphics_fillRect(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   //printf("Java_vdr_mhp_awt_MHPNativeGraphics_fillRect: %dx%d, %dx%d\n", x, y, width, height);   if (x<0)      x=0;   if (y<0)      y=0;   try {      surface->SetDrawingFlags(DSDRAW_BLEND);      surface->FillRectangle(x, y, width+1, height+1);   } catch (DFBException *e) {      int w,h;      surface->GetSize(&w, &h);      printf("DirectFB: Error %s, %s, %dx%d, %dx%d; %dx%d\n", e->GetAction(), e->GetResult(), x, y, width+1, height+1, w, h);      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width+1, y+height+1);}void Java_vdr_mhp_awt_MHPNativeGraphics_fillRoundRect(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeFlipData, jint x, jint y, jint width, jint height, int arcWidth, int arcHeight) {   IDirectFBSurface *surface=((IDirectFBSurface *)nativeData);   //printf("Java_vdr_mhp_awt_MHPNativeGraphics_fillRoundRect: %dx%d, %dx%d\n", x, y, width, height);      if (width<=0 || height<=0 || arcWidth<0 || arcHeight<0)      return;   if (x<0)      x=0;   if (y<0)      y=0;   if (height<arcHeight || width<arcWidth)      return Java_vdr_mhp_awt_MHPNativeGraphics_fillRect(env, obj, nativeData, nativeFlipData, x,y,width, height);      //libxmi operations   miPixel pixels[2];   miGC *pGC;   miPaintedSet *paintedSet;   //miEllipseCache *cache;   miArc arcs[4];   //arcWidth and arcHeight shall be the "the horizontal/vertical diameter of the arc at the four corners"   //Is the the diameter of the 1/4 ellipse, or is this the radius?   //In the structures below, it is the radius.      pixels[0]=0; // pixel value for `off' dashes, if drawn   pixels[1]=1; // default pixel for drawing   pGC = miNewGC(2, pixels);   paintedSet = miNewPaintedSet();   //cache = miNewEllipseCache();      //upper left corner   arcs[0].x=x;   arcs[0].y=y;   arcs[0].width=arcWidth;   arcs[0].height=arcHeight;   arcs[0].angle1=90*64; //starting angle, in 1/64 degrees, counterclockwise from x-axis   arcs[0].angle2=90*64; //angle range, in 1/64 degrees      //lower left   arcs[1].x=x;   arcs[1].y=y+height-arcHeight;   arcs[1].width=arcWidth;   arcs[1].height=arcHeight;   arcs[1].angle1=180*64;   arcs[1].angle2=90*64;      //uper right   arcs[2].x=x+width-arcWidth;   arcs[2].y=y;   arcs[2].width=arcWidth;   arcs[2].height=arcHeight;   arcs[2].angle1=0*64;   arcs[2].angle2=90*64;      //lower right      //lower      if (width-(2*arcWidth)>0 && arcHeight>0)         surface->FillRectangle(x+arcWidth, y+height-arcHeight, width-(2*arcWidth), arcHeight);   arcs[3].x=x+width-arcWidth;   arcs[3].y=y+height-arcHeight;   arcs[3].width=arcWidth;   arcs[3].height=arcHeight;   arcs[3].angle1=0*64;   arcs[3].angle2=-90*64;      miFillArcs(paintedSet, pGC, 4, arcs);     //miDeleteEllipseCache(cache);      //do the actual drawing   try {      surface->SetDrawingFlags(DSDRAW_BLEND);            //draw three rectangles, one with full length but height-archeight,      //two smaller ones above and below with archeight and width-archeight      if ((height - arcHeight + 1)>0)         surface->FillRectangle(x, y + arcHeight / 2, width, height - arcHeight + 1);      if ((width - arcWidth + 1)>0) {         //upper         surface->FillRectangle(x + arcWidth / 2, y, width - arcWidth + 1, arcHeight / 2);         //lower         surface->FillRectangle(x + arcWidth / 2, y + height - arcHeight / 2, width - arcWidth + 1, arcHeight / 2);      }   /*      //first draw five normal rectangles (the corners cut out):      //left rectangle      if (arcWidth>0 && height-(2*arcHeight)>0)         surface->FillRectangle(x, y+arcHeight, arcWidth, height-(2*arcHeight));      //upper      if (width-(2*arcWidth)>0 && arcHeight>0)         surface->FillRectangle(x+arcWidth, y, width-(2*arcWidth), arcHeight);      //right      if (arcWidth>0 &&  height-(2*arcHeight)>0)         surface->FillRectangle(x+width-arcWidth, y+arcHeight, arcWidth, height-(2*arcHeight));      //lower      if (width-(2*arcWidth)>0 && arcHeight>0)         surface->FillRectangle(x+arcWidth, y+height-arcHeight, width-(2*arcWidth), arcHeight);      //middle      if (width-(2*arcWidth)>0 && height-(2*arcHeight)>0)         surface->FillRectangle(x+arcWidth, y+arcHeight, width-(2*arcWidth), height-(2*arcHeight));   */            //now translate the point structures of the paintedSet to the surface's pixels        for (int i = 0; i < paintedSet->ngroups; i++) {         if (paintedSet->groups[i]->group[0].count > 0) {            if (paintedSet->groups[i]->pixel) {               for (int u=0;u<paintedSet->groups[i]->group[0].count;u++) {                                 surface->DrawLine(paintedSet->groups[i]->group[0].points[u].x,                                    paintedSet->groups[i]->group[0].points[u].y,                                    paintedSet->groups[i]->group[0].points[u].x + paintedSet->groups[i]->group[0].widths[u],                                    paintedSet->groups[i]->group[0].points[u].y);               }            }         }      }         } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      miDeleteGC (pGC);      miDeletePaintedSet (paintedSet);      delete e;      return;   }   ((FlipData *)nativeFlipData)->addUpdate(x, y, x+width+1, y+height+1);   miDeleteGC (pGC);   miDeletePaintedSet (paintedSet);}void Java_vdr_mhp_awt_MHPNativeGraphics_setClip(JNIEnv* env, jobject obj, jlong nativeData, jint x, jint y, jint width, jint height) {   try {      //printf("MHPNativeGraphics_setClip for %p: %dx%d, %dx%d\n", nativeData, x, y, width, height);      if (x==-1 && y==-1 && width==-1 && height==-1) //internal special case         return ((IDirectFBSurface *)nativeData)->SetClip(NULL);      DFBRegion region={x, y, x+width, y+height};      return ((IDirectFBSurface *)nativeData)->SetClip( &region );   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }  }void Java_vdr_mhp_awt_MHPNativeGraphics_setColor(JNIEnv* env, jobject obj, jlong nativeData, jint r, jint g, jint b, jint a) {   try {      return ((IDirectFBSurface *)nativeData)->SetColor(r, g, b, a);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }  }void Java_vdr_mhp_awt_MHPNativeGraphics_setFont(JNIEnv* env, jobject obj, jlong nativeData, jlong nativeDataFont) {   try {      return ((IDirectFBSurface *)nativeData)->SetFont((IDirectFBFont *)nativeDataFont);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }     }void Java_vdr_mhp_awt_MHPNativeGraphics_setPorterDuff(JNIEnv* env, jobject obj, jlong nativeData, jint rule) {   try {      return ((IDirectFBSurface *)nativeData)->SetPorterDuff((DFBSurfacePorterDuffRule)rule);   } catch (DFBException *e) {      printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());      delete e;      return;   }}void Java_vdr_mhp_awt_MHPNativeGraphics_enterBuffered(JNIEnv* env, jobject obj, jlong nativeFlipData) {   ((FlipData *)nativeFlipData)->enterBuffered();}void Java_vdr_mhp_awt_MHPNativeGraphics_leaveBuffered(JNIEnv* env, jobject obj, jlong nativeFlipData) {   ((FlipData *)nativeFlipData)->leaveBuffered();}/*void Java_vdr_mhp_awt_MHPNativeGraphics_addRefFlip(JNIEnv* env, jobject obj, int nativeFlipData) {   ((FlipData *)nativeFlipData)->addRef(nativeFlipData);}void Java_vdr_mhp_awt_MHPNativeGraphics_removeRefFlip(JNIEnv* env, jobject obj, int nativeFlipData) {   ((FlipData *)nativeFlipData)->removeRef(nativeFlipData);}*/} // extern "C"