Skip to content

Deprecate XOR-related methods in Shape#1019

Open
ptziegler wants to merge 1 commit intoeclipse-gef:masterfrom
ptziegler:deprecate-make-ghost-shape
Open

Deprecate XOR-related methods in Shape#1019
ptziegler wants to merge 1 commit intoeclipse-gef:masterfrom
ptziegler:deprecate-make-ghost-shape

Conversation

@ptziegler
Copy link
Copy Markdown
Contributor

@ptziegler ptziegler commented Feb 18, 2026

This is a continuation of f7a00b18852d83a98b4fb11aea0d9c6f4186cba5. XOR is unsupported on Windows when GDI+ (advanced mode) is enabled and returns a black shadow, rather than a blending of the figure and its background. Due to the support for fractional scaling (and the deprecation of ScaledGraphics), advanced mode is almost always active on Windows.

@ptziegler
Copy link
Copy Markdown
Contributor Author

Just as an example on how this looks like. The biggest topics is the dark/light theme and how it looks in "real" editors.

image

@ptziegler
Copy link
Copy Markdown
Contributor Author

With the dark theme:

image

@ptziegler
Copy link
Copy Markdown
Contributor Author

Especially when it comes to resizing, the outline is the essential part. Otherwise you have no idea what you're doing. Using two contrasting colors seems to work well because one will always try to draw your attention.

@Phillipus
Copy link
Copy Markdown
Contributor

Also here:

protected IFigure getSizeOnDropFeedback() {
if (sizeOnDropFeedback == null) {
sizeOnDropFeedback = new RectangleFigure();
FigureUtilities.makeGhostShape((Shape) sizeOnDropFeedback);
((Shape) sizeOnDropFeedback).setLineStyle(Graphics.LINE_DASHDOT);
sizeOnDropFeedback.setForegroundColor(ColorConstants.white);
addFeedback(sizeOnDropFeedback);
}
return sizeOnDropFeedback;
}

@ptziegler
Copy link
Copy Markdown
Contributor Author

Every class that uses XOR needs to be adapted. Also including these:

ConnectionFocus() {
setFill(false);
setForegroundColor(ColorConstants.white);
setXOR(true);
setOutline(true);
}

figure = new RectangleFigure();
((RectangleFigure) figure).setXOR(true);
((RectangleFigure) figure).setFill(true);
figure.setBackgroundColor(LogicColorConstants.ghostFillColor);
figure.setForegroundColor(ColorConstants.white);

figure = new RectangleFigure();
((RectangleFigure) figure).setXOR(true);
((RectangleFigure) figure).setFill(true);
figure.setBackgroundColor(LogicColorConstants.ghostFillColor);
figure.setForegroundColor(ColorConstants.white);

public CircuitFeedbackFigure() {
this.setFill(false);
this.setXOR(true);
setBorder(new CircuitFeedbackBorder());
}

public LogicFlowFeedbackFigure() {
this.setFill(false);
this.setXOR(true);
setBorder(new LogicFlowFeedbackBorder());
}

(Though the figures are already updated by #704).

This is first and foremost just an idea to explore alternatives.

@azoitl
Copy link
Copy Markdown
Contributor

azoitl commented Feb 19, 2026

For that problem. HSL shines. There are several options to create contrast or complementary colors, either by tweaking the hue part or by working with saturation and luminosity combined.

In 4diac IDE we use now for quite some time the selection color for the border and fill with selection color with alpha. Even with colored background and in darkmode this works really good. We have a border of width 2 and the alpha is 50.

@Phillipus
Copy link
Copy Markdown
Contributor

Phillipus commented Feb 22, 2026

Using a RectangleFigure leads to the same problem I reported in #1020 The rectangle line width is clipped on the top and left sides:

Image 003

@ptziegler ptziegler force-pushed the deprecate-make-ghost-shape branch from 4048919 to eb57840 Compare April 5, 2026 12:36
@ptziegler ptziegler changed the title Deprecate XOR-related methods in FigureUtilities and Shape Deprecate XOR-related methods in Shape Apr 5, 2026
@ptziegler ptziegler marked this pull request as ready for review April 5, 2026 12:37
This is a continuation of f7a00b18852d83a98b4fb11aea0d9c6f4186cba5. XOR
is unsupported on Windows when GDI+ (advanced mode) is enabled and
returns a black shadow, rather than a blending of the figure and its
background. Due to the support for fractional scaling (and the
deprecation of `ScaledGraphics`), advanced mode is almost always active
on Windows.
@ptziegler ptziegler force-pushed the deprecate-make-ghost-shape branch from eb57840 to 935635a Compare April 5, 2026 12:43
@ptziegler
Copy link
Copy Markdown
Contributor Author

I've rebased this PR so that now only deprecation of the XOR-related methods in the Shape class remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants