/**
  * Constructs a new Pattern given an image. Drawing with the resulting pattern will cause the
  * image to be tiled over the resulting area.
  *
  * <p>This operation requires the operating system's advanced graphics subsystem which may not be
  * available on some platforms.
  *
  * @param device the device on which to allocate the pattern
  * @param image the image that the pattern will draw
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, or the
  *           image is null
  *       <li>ERROR_INVALID_ARGUMENT - if the image has been disposed
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_NO_GRAPHICS_LIBRARY - if advanced graphics are not available
  *     </ul>
  *
  * @exception SWTError
  *     <ul>
  *       <li>ERROR_NO_HANDLES if a handle for the pattern could not be obtained
  *     </ul>
  *
  * @see #dispose()
  */
 public Pattern(Device device, Image image) {
   super(device);
   if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
   if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
   this.device.checkCairo();
   image.createSurface();
   handle = Cairo.cairo_pattern_create_for_surface(image.surface);
   if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
   Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT);
   surface = image.surface;
   init();
 }