java类org.eclipse.swt.graphics.Region的实例源码

Sleak.java 文件源码 项目:simpledance 阅读 30 收藏 0 点赞 0 评论 0
void refreshLabel()
{
    int colors = 0,
        cursors = 0,
        fonts = 0,
        gcs = 0,
        images = 0,
        regions = 0;
    for (int i = 0; i < objects.length; i++)
    {
        Object object = objects[i];
        if (object instanceof Color)
            colors++;
        if (object instanceof Cursor)
            cursors++;
        if (object instanceof Font)
            fonts++;
        if (object instanceof GC)
            gcs++;
        if (object instanceof Image)
            images++;
        if (object instanceof Region)
            regions++;
    }
    String string = "";
    if (colors != 0)
        string += colors + " Color(s)\n";
    if (cursors != 0)
        string += cursors + " Cursor(s)\n";
    if (fonts != 0)
        string += fonts + " Font(s)\n";
    if (gcs != 0)
        string += gcs + " GC(s)\n";
    if (images != 0)
        string += images + " Image(s)\n";
    if (regions != 0) string += regions + " Region(s)\n";
    if (string.length() != 0)
    {
        string = string.substring(0, string.length() - 1);
    }
    label.setText(string);
}
Sleak.java 文件源码 项目:pentaho-kettle 阅读 29 收藏 0 点赞 0 评论 0
void refreshLabel() {
  int colors = 0, cursors = 0, fonts = 0, gcs = 0, images = 0;
  int paths = 0, patterns = 0, regions = 0, textLayouts = 0, transforms = 0;
  for ( int i = 0; i < objects.length; i++ ) {
    Object object = objects[i];
    if ( object instanceof Color ) {
      colors++;
    }
    if ( object instanceof Cursor ) {
      cursors++;
    }
    if ( object instanceof Font ) {
      fonts++;
    }
    if ( object instanceof GC ) {
      gcs++;
    }
    if ( object instanceof Image ) {
      images++;
    }
    if ( object instanceof Path ) {
      paths++;
    }
    if ( object instanceof Pattern ) {
      patterns++;
    }
    if ( object instanceof Region ) {
      regions++;
    }
    if ( object instanceof TextLayout ) {
      textLayouts++;
    }
    if ( object instanceof Transform ) {
      transforms++;
    }
  }
  String string = "";
  if ( colors != 0 ) {
    string += colors + " Color(s)\n";
  }
  if ( cursors != 0 ) {
    string += cursors + " Cursor(s)\n";
  }
  if ( fonts != 0 ) {
    string += fonts + " Font(s)\n";
  }
  if ( gcs != 0 ) {
    string += gcs + " GC(s)\n";
  }
  if ( images != 0 ) {
    string += images + " Image(s)\n";
  }
  if ( paths != 0 ) {
    string += paths + " Paths(s)\n";
  }
  if ( patterns != 0 ) {
    string += patterns + " Pattern(s)\n";
  }
  if ( regions != 0 ) {
    string += regions + " Region(s)\n";
  }
  if ( textLayouts != 0 ) {
    string += textLayouts + " TextLayout(s)\n";
  }
  if ( transforms != 0 ) {
    string += transforms + " Transform(s)\n";
  }
  if ( string.length() != 0 ) {
    string = string.substring( 0, string.length() - 1 );
  }
  label.setText( string );
}
PopOverShell.java 文件源码 项目:swt-bling 阅读 24 收藏 0 点赞 0 评论 0
private Point getPopOverShellLocation(Shell parentShell, PoppedOverItem poppedOverItem, Region popOverRegion) {

    Point location;
    Rectangle displayBounds = null;

    try {
      Display display = displaySafe.getLatestDisplay();
      displayBounds = display.getBounds();
    } catch (DisplaySafe.NullDisplayException nde) {
      LOG.warning("Could not find display");
    }

    Rectangle popOverBounds = popOverRegion.getBounds();
    Point poppedOverItemLocationRelativeToDisplay =
            getPoppedOverItemRelativeLocation(poppedOverItem);

    // Guess on the location first
    location = getPopOverDisplayPoint(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverEdgeCenteredOnParent, popOverAboveOrBelowParent);

    // Adjust as needed
    if (popOverAboveOrBelowParent == VerticalLocation.BELOW) {
      if (isBottomCutOff(displayBounds, location, popOverBounds)) {
        popOverAboveOrBelowParent = VerticalLocation.ABOVE;
        location.y = getPopOverYLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
                popOverAboveOrBelowParent);
      }
    } else {
      if (isTopCutOff(location)) {
        popOverAboveOrBelowParent = VerticalLocation.BELOW;
        location.y = getPopOverYLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverAboveOrBelowParent);
      }
    }

    if (popOverEdgeCenteredOnParent == CenteringEdge.LEFT) {
      if (isRightCutOff(displayBounds, location, popOverBounds)) {
        popOverEdgeCenteredOnParent = CenteringEdge.RIGHT;
        location.x = getPopOverXLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
                popOverEdgeCenteredOnParent);
      }
    } else {
      if (isLeftCutOff(location)) {
        popOverEdgeCenteredOnParent = CenteringEdge.LEFT;
        location.x = getPopOverXLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverEdgeCenteredOnParent);
      }
    }

    if (isStillOffScreen(displayBounds, location, popOverBounds)) {
      location = getPopOverLocationControlOffscreen(displayBounds, popOverRegion,
              poppedOverItemLocationRelativeToDisplay, location);
    }

    return location;
  }
Shell.java 文件源码 项目:gef-gwt 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Sets the shape of the shell to the region specified by the argument. When
 * the argument is null, the default shape of the shell is restored. The
 * shell must be created with the style SWT.NO_TRIM in order to specify a
 * region.
 * 
 * @param region
 *            the region that defines the shape of the shell (or null)
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_INVALID_ARGUMENT - if the region has been
 *                disposed</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @since 3.0
 * 
 */
public void setRegion(Region region) {
    checkWidget();
    if ((style & SWT.NO_TRIM) == 0)
        return;
    super.setRegion(region);
}
PieUtils.java 文件源码 项目:BiglyBT 阅读 24 收藏 0 点赞 0 评论 0
public static void
drawPie(
    GC gc,Image image, int x, int y,int width,int height,int percent, boolean draw_border )
{
    Rectangle image_size = image.getBounds();

    int width_pad   = ( width - image_size.width  )/2;
    int height_pad  = ( height - image_size.height  )/2;

    int angle = (percent * 360) / 100;
    if(angle<4){
        angle = 0; // workaround fillArc rendering bug
    }

    Region old_clipping = new Region();

    gc.getClipping(old_clipping);

    Path path_done = new Path(gc.getDevice());

    path_done.addArc(x,y,width,height,90,-angle);
    path_done.lineTo( x+width/2, y+height/2);
    path_done.close();

    gc.setClipping( path_done );

    gc.drawImage(image, x+width_pad, y+height_pad+1);

    Path path_undone = new Path(gc.getDevice());

    path_undone.addArc(x,y,width,height,90-angle,angle-360);
    path_undone.lineTo( x+width/2, y+height/2);
    path_undone.close();

    gc.setClipping( path_undone );

    gc.setAlpha( 75 );
    gc.drawImage(image, x+width_pad, y+height_pad+1);
    gc.setAlpha( 255 );

    gc.setClipping( old_clipping );

    if ( draw_border ){

        gc.setForeground(Colors.blue);

        if ( percent == 100 ){

            gc.drawOval(x , y , width-1, height-1);

        }else{

            if ( angle > 0 ){

                gc.drawPath( path_done );
            }
        }
    }

    path_done.dispose();
    path_undone.dispose();
    old_clipping.dispose();

}
PieUtils.java 文件源码 项目:AcademicTorrents-Downloader 阅读 29 收藏 0 点赞 0 评论 0
public static void 
drawPie(
    GC gc,Image image, int x, int y,int width,int height,int percent, boolean draw_border ) 
{
    Rectangle image_size = image.getBounds();

    int width_pad   = ( width - image_size.width  )/2;
    int height_pad  = ( height - image_size.height  )/2;

    int angle = (percent * 360) / 100;
    if(angle<4){
        angle = 0; // workaround fillArc rendering bug
    }

    Region old_clipping = new Region();

    gc.getClipping(old_clipping);

    Path path_done = new Path(gc.getDevice());

    path_done.addArc(x,y,width,height,90,-angle);
    path_done.lineTo( x+width/2, y+height/2);
    path_done.close();

    gc.setClipping( path_done );

    gc.drawImage(image, x+width_pad, y+height_pad+1);

    Path path_undone = new Path(gc.getDevice());

    path_undone.addArc(x,y,width,height,90-angle,angle-360);
    path_undone.lineTo( x+width/2, y+height/2);
    path_undone.close();

    gc.setClipping( path_undone );

    gc.setAlpha( 75 );
    gc.drawImage(image, x+width_pad, y+height_pad+1);
    gc.setAlpha( 255 );

    gc.setClipping( old_clipping );

    if ( draw_border ){

        gc.setForeground(Colors.blue);

        if ( percent == 100 ){

            gc.drawOval(x , y , width-1, height-1);

        }else{

            if ( angle > 0 ){

                gc.drawPath( path_done );
            }
        }
    }

    path_done.dispose();
    path_undone.dispose();
    old_clipping.dispose();

}
Control.java 文件源码 项目:gef-gwt 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Sets the shape of the control to the region specified by the argument.
 * When the argument is null, the default shape of the control is restored.
 * 
 * @param region
 *            the region that defines the shape of the control (or null)
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_INVALID_ARGUMENT - if the region has been
 *                disposed</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @since 3.4
 */
public void setRegion(Region region) {
}
Control.java 文件源码 项目:gef-gwt 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Returns the region that defines the shape of the control, or null if the
 * control has the default shape.
 * 
 * @return the region that defines the shape of the shell (or null)
 * 
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @since 3.4
 */
public Region getRegion() {
    checkWidget();
    return region;
}
Shell.java 文件源码 项目:gef-gwt 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Returns the region that defines the shape of the shell, or
 * <code>null</code> if the shell has the default shape.
 * 
 * @return the region that defines the shape of the shell, or
 *         <code>null</code>
 * 
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @since 3.0
 * 
 */
public Region getRegion() {
    /* This method is needed for @since 3.0 Javadoc */
    checkWidget();
    return region;
}


问题


面经


文章

微信
公众号

扫码关注公众号