Rectangle getBounds(int zoom) { Rectangle bounds = getBoundsInPixels(); if (bounds != null && zoom != currentDeviceZoom) { bounds = DPIUtil.autoScaleBounds(bounds, zoom, currentDeviceZoom); } return bounds; }
Point getSizeInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Point (rect.width, rect.height); } else { if (width == 0) { return new Point (DEFAULT_WIDTH, height); } } return new Point (width, height); }
Point getSizeInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Point (rect.width, rect.height); } else { if (width == 0) { return new Point (DEFAULT_WIDTH, height); } } return new Point (width, height); }
Point getSizeInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Point (rect.width, rect.height); } else { if (width == 0) { return new Point (DEFAULT_WIDTH, height); } } return new Point (width, height); }
Point getSizeInPixels () { if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Point (rect.width, rect.height); } else { if (!OS.IsWinCE && width == 0) { int [] buffer = new int [1]; if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) { return new Point (buffer [0], height); } } } return new Point (width, height); }
/** * Returns the bounds of the receiver. The rectangle will always * have x and y values of 0, and the width and height of the * image. * * @return a rectangle specifying the image's bounds in points. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> * </ul> */ public Rectangle getBounds() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return DPIUtil.autoScaleBounds(getBoundsInPixels(), 100, currentDeviceZoom); }
/** * Returns the bounds of the receiver. The rectangle will always * have x and y values of 0, and the width and height of the * image. * * @return a rectangle specifying the image's bounds in points. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> * </ul> */ public Rectangle getBounds() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return DPIUtil.autoScaleBounds(getBoundsInPixels(), 100, currentDeviceZoom); }
/** * Returns the bounds of the receiver. The rectangle will always * have x and y values of 0, and the width and height of the * image. * * @return a rectangle specifying the image's bounds in points. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> * </ul> */ public Rectangle getBounds() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return DPIUtil.autoScaleBounds(getBoundsInPixels(), 100, currentDeviceZoom); }
Rectangle getBoundsInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Rectangle (x, y, rect.width, rect.height); } else { if (width == 0) { return new Rectangle (x, y, DEFAULT_WIDTH, height); } } return new Rectangle (x, y, width, height); }
Rectangle getBoundsInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Rectangle (x, y, rect.width, rect.height); } else { if (width == 0) { return new Rectangle (x, y, DEFAULT_WIDTH, height); } } return new Rectangle (x, y, width, height); }
Rectangle getBoundsInPixels () { checkWidget(); if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Rectangle (x, y, rect.width, rect.height); } else { if (width == 0) { return new Rectangle (x, y, DEFAULT_WIDTH, height); } } return new Rectangle (x, y, width, height); }
Rectangle getBoundsInPixels () { if (image != null) { Rectangle rect = image.getBoundsInPixels (); return new Rectangle (x, y, rect.width, rect.height); } else { if (!OS.IsWinCE && width == 0) { int [] buffer = new int [1]; if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) { return new Rectangle (x, y, buffer [0], height); } } } return new Rectangle (x, y, width, height); }
@Override public void setImage (Image image) { super.setImage (image); int oldImageHeight = imageHeight; if (image != null) { Rectangle bounds = image.getBoundsInPixels (); imageHeight = bounds.height; imageWidth = bounds.width; } else { imageHeight = imageWidth = 0; } if (oldImageHeight != imageHeight) { parent.layoutItems (parent.indexOf (this), true); } else { redraw (true); } }
int imageIndex (Image image) { if (image == null) return OS.I_IMAGENONE; if (imageList == null) { Rectangle bounds = image.getBoundsInPixels (); imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height); int index = imageList.add (image); int /*long*/ hImageList = imageList.getHandle (); OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, hImageList); return index; } int index = imageList.indexOf (image); if (index == -1) { index = imageList.add (image); } else { imageList.put (index, image); } return index; }
int imageIndex (Image image) { if (hwndCB == 0 || image == null) return OS.I_IMAGENONE; if (imageList == null) { Rectangle bounds = image.getBoundsInPixels (); imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height); int index = imageList.add (image); int /*long*/ hImageList = imageList.getHandle (); OS.SendMessage (hwndCB, OS.TB_SETIMAGELIST, 0, hImageList); return index; } int index = imageList.indexOf (image); if (index == -1) { index = imageList.add (image); } else { imageList.put (index, image); } return index; }
void copyAreaInPixels(Image image, int x, int y) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); /* Copy the bitmap area */ Rectangle rect = image.getBoundsInPixels(); int /*long*/ memHdc = OS.CreateCompatibleDC(handle); int /*long*/ hOldBitmap = OS.SelectObject(memHdc, image.handle); OS.BitBlt(memHdc, 0, 0, rect.width, rect.height, handle, x, y, OS.SRCCOPY); OS.SelectObject(memHdc, hOldBitmap); OS.DeleteDC(memHdc); }
int imageIndexHeader (Image image) { if (image == null) return OS.I_IMAGENONE; if (headerImageList == null) { Rectangle bounds = image.getBoundsInPixels (); headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height); int index = headerImageList.indexOf (image); if (index == -1) index = headerImageList.add (image); int /*long*/ hImageList = headerImageList.getHandle (); int /*long*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, hImageList); return index; } int index = headerImageList.indexOf (image); if (index != -1) return index; return headerImageList.add (image); }
int imageIndexHeader (Image image) { if (image == null) return OS.I_IMAGENONE; if (headerImageList == null) { Rectangle bounds = image.getBoundsInPixels (); headerImageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height); int index = headerImageList.indexOf (image); if (index == -1) index = headerImageList.add (image); int /*long*/ hImageList = headerImageList.getHandle (); if (hwndHeader != 0) { OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, hImageList); } updateScrollBar (); return index; } int index = headerImageList.indexOf (image); if (index != -1) return index; return headerImageList.add (image); }
public static int /*long*/ convertSurface(Image image) { int /*long*/ newSurface = image.surface; int type = Cairo.cairo_surface_get_type(newSurface); if (type != Cairo.CAIRO_SURFACE_TYPE_IMAGE) { Rectangle bounds = image.getBoundsInPixels(); int format = Cairo.cairo_surface_get_content(newSurface) == Cairo.CAIRO_CONTENT_COLOR ? Cairo.CAIRO_FORMAT_RGB24 : Cairo.CAIRO_FORMAT_ARGB32; newSurface = Cairo.cairo_image_surface_create(format, bounds.width, bounds.height); if (newSurface == 0) SWT.error(SWT.ERROR_NO_HANDLES); int /*long*/ cairo = Cairo.cairo_create(newSurface); if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES); Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_SOURCE); Cairo.cairo_set_source_surface (cairo, image.surface, 0, 0); Cairo.cairo_paint (cairo); Cairo.cairo_destroy(cairo); } else { Cairo.cairo_surface_reference(newSurface); } return newSurface; }
public static int /*long*/ convertSurface(Image image) { int /*long*/ newSurface = image.surface; int type = Cairo.cairo_surface_get_type(newSurface); if (type != Cairo.CAIRO_SURFACE_TYPE_IMAGE) { Rectangle bounds = image.getBoundsInPixels(); int format = Cairo.cairo_surface_get_content(newSurface) == Cairo.CAIRO_CONTENT_COLOR ? Cairo.CAIRO_FORMAT_RGB24 : Cairo.CAIRO_FORMAT_ARGB32; newSurface = Cairo.cairo_image_surface_create(format, bounds.width, bounds.height); if (newSurface == 0) SWT.error(SWT.ERROR_NO_HANDLES); int /*long*/ cairo = Cairo.cairo_create(newSurface); if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES); Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_SOURCE); Cairo.cairo_set_source_surface (cairo, image.surface, 0, 0); Cairo.cairo_paint (cairo); Cairo.cairo_destroy(cairo); } else { Cairo.cairo_surface_reference(newSurface); } return newSurface; }