gpt4 book ai didi

org.weasis.core.ui.editor.image.ZoomWin类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 05:38:31 29 4
gpt4 key购买 nike

本文整理了Java中org.weasis.core.ui.editor.image.ZoomWin类的一些代码示例,展示了ZoomWin类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoomWin类的具体详情如下:
包路径:org.weasis.core.ui.editor.image.ZoomWin
类名称:ZoomWin

ZoomWin介绍

[英]The Class ZoomWin.
[中]全班同学都在放大。

代码示例

代码示例来源:origin: nroduit/Weasis

protected void draw(Graphics2D g2d) {
  Stroke oldStroke = g2d.getStroke();
  Paint oldColor = g2d.getPaint();
  Shape oldClip = g2d.getClip();
  g2d.clip(shape);
  g2d.setBackground(backgroundColor);
  drawBackground(g2d);
  // Set font size according to the view size
  g2d.setFont(MeasureTool.viewSetting.getFont());
  // Paint the visible area
  Point2D p = getClipViewCoordinatesOffset();
  g2d.translate(p.getX(), p.getY());
  imageLayer.drawImage(g2d);
  drawLayers(g2d, affineTransform, inverseTransform);
  g2d.translate(-p.getX(), -p.getY());
  g2d.setClip(oldClip);
  g2d.setStroke(stroke);
  g2d.setPaint(lineColor);
  Rectangle bound = getBounds();
  g2d.drawRect(bound.width - 12 - borderOffset, bound.height - 12 - borderOffset, 12, 12);
  g2d.draw(shape);
  g2d.setPaint(oldColor);
  g2d.setStroke(oldStroke);
}

代码示例来源:origin: nroduit/Weasis

public void centerZoomWin() {
  int magPosx = (view2d.getWidth() / 2) - (getWidth() / 2);
  int magPosy = (view2d.getHeight() / 2) - (getHeight() / 2);
  setLocation(magPosx, magPosy);
}

代码示例来源:origin: nroduit/Weasis

public void showLens(boolean val) {
  if (val) {
    updateImage();
    refreshZoomWin();
    updateZoom();
    enableMouseListener();
    setVisible(true);
  } else {
    setVisible(false);
    view2d.graphicManager.removeGraphicChangeHandler(graphicsChangeHandler);
    disableMouseAndKeyListener();
  }
}

代码示例来源:origin: nroduit/Weasis

public void enableMouseListener() {
  disableMouseAndKeyListener();
  this.addMouseListener(mouseHandler);
  this.addMouseMotionListener(mouseHandler);
  this.addMouseWheelListener((MouseActionAdapter) view2d.getEventManager().getAction(ActionW.LENSZOOM));
}

代码示例来源:origin: nroduit/Weasis

private void refreshZoomWin() {
  Point loc = getLocation();
  if (loc.x == -1 && loc.y == -1) {
    centerZoomWin();
    return;
  }
  Rectangle rect = view2d.getBounds();
  rect.x = 0;
  rect.y = 0;
  Rectangle2D r = rect.createIntersection(getBounds());
  if (r.getWidth() < 25.0 || r.getHeight() < 25.0) {
    centerZoomWin();
  }
}

代码示例来源:origin: nroduit/Weasis

int h = getHeight();
if (w != 0 && h != 0) {
  Rectangle bound = lens.getBounds();
  if (oldSize.width != 0 && oldSize.height != 0) {
    int centerx = bound.width / 2;
    bound.x = (bound.x + centerx) * w / oldSize.width - centerx;
    bound.y = (bound.y + centery) * h / oldSize.height - centery;
    lens.setLocation(bound.x, bound.y);
lens.updateZoom();

代码示例来源:origin: nroduit/Weasis

lens.setActionInView(ActionW.ZOOM.cmd(), entry.getValue());
  lens.updateZoom();
if (showLens) {
  if (lens == null) {
    lens = new ZoomWin<>(this);
  lens.setSize(lens.getWidth() > maxWidth ? maxWidth : lens.getWidth(),
    lens.getHeight() > maxHeight ? maxHeight : lens.getHeight());
  this.add(lens);
  lens.showLens(true);

代码示例来源:origin: nroduit/Weasis

public ZoomWin(DefaultView2d<E> view2d) {
  super(null);
  this.view2d = view2d;
  this.setOpaque(false);
  ImageViewerEventManager<E> manager = view2d.getEventManager();
  this.imageLayer = new RenderedImageLayer<>();
  SimpleOpManager operations = imageLayer.getDisplayOpManager();
  operations.addImageOperationAction(new AffineTransformOp());
  ActionState zoomAction = manager.getAction(ActionW.LENSZOOM);
  if (zoomAction instanceof SliderChangeListener) {
    actionsInView.put(ActionW.ZOOM.cmd(), ((SliderChangeListener) zoomAction).getRealValue());
  }
  this.popup = new PopUpMenuOnZoom(this);
  this.popup.setInvoker(this);
  this.setCursor(DefaultView2d.MOVE_CURSOR);
  ZoomSetting z = manager.getZoomSetting();
  OpManager disOp = getDisplayOpManager();
  disOp.setParamValue(AffineTransformOp.OP_NAME, AffineTransformOp.P_INTERPOLATION, z.getInterpolation());
  disOp.setParamValue(AffineTransformOp.OP_NAME, AffineTransformOp.P_AFFINE_MATRIX, null);
  actionsInView.put(SYNCH_CMD, z.isLensSynchronize());
  actionsInView.put(ActionW.DRAWINGS.cmd(), z.isLensShowDrawings());
  actionsInView.put(FREEZE_CMD, SyncType.NONE);
  Color bckColor = UIManager.getColor("Panel.background"); //$NON-NLS-1$
  this.setLensDecoration(z.getLensLineWidth(), z.getLensLineColor(), bckColor, z.isLensRound());
  this.setSize(z.getLensWidth(), z.getLensHeight());
  this.setLocation(-1, -1);
  this.imageLayer.addLayerChangeListener(this);
  this.mouseHandler = new MouseHandler();
}

代码示例来源:origin: nroduit/Weasis

private void init() {
  jMenuItemZoom.setText(Messages.getString("PopUpMenuOnZoom.hide")); //$NON-NLS-1$
  jMenuItemZoom.addActionListener(e -> zoomWin.hideZoom());
  jCheckBoxMenuItemDraw.setText(Messages.getString("PopUpMenuOnZoom.showDraw")); //$NON-NLS-1$
  jCheckBoxMenuItemDraw.addActionListener(e -> {
    zoomWin.setActionInView(ActionW.DRAWINGS.cmd(), jCheckBoxMenuItemDraw.isSelected());
    zoomWin.repaint();
  });
  jMenuImage.setText(Messages.getString("PopUpMenuOnZoom.image")); //$NON-NLS-1$
  final JMenuItem freezParams = new JMenuItem(Messages.getString("PopUpMenuOnZoom.freeze")); //$NON-NLS-1$
  freezParams.addActionListener(e -> zoomWin.setFreezeImage(SyncType.PARENT_PARAMETERS));
  jMenuImage.add(freezParams);
  final JMenuItem freeze = new JMenuItem(Messages.getString("PopUpMenuOnZoom.freezeImg")); //$NON-NLS-1$
  freeze.addActionListener(e -> zoomWin.setFreezeImage(SyncType.PARENT_IMAGE));
  jMenuImage.add(freeze);
  jMenuImage.addSeparator();
  resetFreeze.addActionListener(e -> zoomWin.setFreezeImage(null));
  jMenuImage.add(resetFreeze);
  jCheckBoxMenutemSychronize.setText(Messages.getString("PopUpMenuOnZoom.synch")); //$NON-NLS-1$
  jCheckBoxMenutemSychronize.addActionListener(e -> {
    zoomWin.setActionInView(ZoomWin.SYNCH_CMD, jCheckBoxMenutemSychronize.isSelected());
    zoomWin.updateZoom();
  });
  this.add(jMenuItemZoom);

代码示例来源:origin: nroduit/Weasis

lens.setCommandFromParentView(command, evt.getNewValue());
lens.updateZoom();

代码示例来源:origin: nroduit/Weasis

public void setFreezeImage(SyncType type) {
  actionsInView.put(ZoomWin.FREEZE_CMD, type);
  if (Objects.isNull(type) || SyncType.NONE.equals(type)) {
    freezeActionsInView.clear();
    freezeOperations = null;
    actionsInView.put(ZoomWin.FREEZE_CMD, SyncType.NONE);
  } else {
    freezeParentParameters();
  }
  imageLayer.updateDisplayOperations();
  updateZoom();
}

代码示例来源:origin: nroduit/Weasis

@Override
public void changeZoomInterpolation(Integer interpolation) {
  Integer val =
    (Integer) getDisplayOpManager().getParamValue(AffineTransformOp.OP_NAME, AffineTransformOp.P_INTERPOLATION);
  boolean update = !Objects.equals(val, interpolation);
  if (update) {
    getDisplayOpManager().setParamValue(AffineTransformOp.OP_NAME, AffineTransformOp.P_INTERPOLATION,
      interpolation);
    if (lens != null) {
      lens.getDisplayOpManager().setParamValue(AffineTransformOp.OP_NAME, AffineTransformOp.P_INTERPOLATION,
        interpolation);
      lens.updateZoom();
    }
    imageLayer.updateDisplayOperations();
  }
}

代码示例来源:origin: nroduit/Weasis

lens.updateImage();
lens.updateZoom();

代码示例来源:origin: nroduit/Weasis

@Override
public synchronized void enableMouseAndKeyListener(MouseActions actions) {
  disableMouseAndKeyListener();
  iniDefaultMouseListener();
  iniDefaultKeyListener();
  // Set the butonMask to 0 of all the actions
  resetMouseAdapter();
  this.setCursor(DefaultView2d.DEFAULT_CURSOR);
  addMouseAdapter(actions.getLeft(), InputEvent.BUTTON1_DOWN_MASK); // left mouse button
  if (actions.getMiddle().equals(actions.getLeft())) {
    // If mouse action is already registered, only add the modifier mask
    addModifierMask(actions.getMiddle(), InputEvent.BUTTON2_DOWN_MASK);
  } else {
    addMouseAdapter(actions.getMiddle(), InputEvent.BUTTON2_DOWN_MASK);// middle mouse button
  }
  if (actions.getRight().equals(actions.getLeft()) || actions.getRight().equals(actions.getMiddle())) {
    // If mouse action is already registered, only add the modifier mask
    addModifierMask(actions.getRight(), InputEvent.BUTTON3_DOWN_MASK);
  } else {
    addMouseAdapter(actions.getRight(), InputEvent.BUTTON3_DOWN_MASK); // right mouse button
  }
  this.addMouseWheelListener(getMouseAdapter(actions.getWheel()));
  if (lens != null) {
    lens.enableMouseListener();
  }
}

代码示例来源:origin: nroduit/Weasis

int h = getHeight();
if (w != 0 && h != 0) {
  Rectangle bound = lens.getBounds();
  if (oldSize.width != 0 && oldSize.height != 0) {
    int centerx = bound.width / 2;
    bound.x = (bound.x + centerx) * w / oldSize.width - centerx;
    bound.y = (bound.y + centery) * h / oldSize.height - centery;
    lens.setLocation(bound.x, bound.y);
lens.updateZoom();

代码示例来源:origin: nroduit/Weasis

lens.setCommandFromParentView(name, evt.getNewValue());
lens.updateZoom();

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com