-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Callback for dynamic drawing with a GC on images
This commit contributes a new interface that can to used to initialize images with. The ImageGcDrawer interface should be used to replace the common use case of images to be used as the pane for a GC to draw on. This usecase leads to issues with the multi-zoom-support added to the win32 implementation, but can lead to scaling artifacts on other platforms as well, if the usages leads to scaling ofImageData.
- Loading branch information
1 parent
e0b4fe9
commit 2a42de9
Showing
5 changed files
with
241 additions
and
6 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageGcDrawer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Yatta and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Yatta - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.graphics; | ||
|
||
/** | ||
* Interface to provide a callback mechanism to draw on different GC instances | ||
* depending on the zoom the image will be used for. A common use case is when the | ||
* application is moved from a low DPI monitor to a high DPI monitor. | ||
* This provides API which will be called by SWT during the image rendering. | ||
* | ||
* This interface needs to be implemented by client code to private logic that draws | ||
* on the empty GC on demand. | ||
* | ||
* @since 3.129 | ||
*/ | ||
public interface ImageGcDrawer { | ||
|
||
|
||
/** | ||
* Provides a GC to draw on for a requested zoom level. | ||
* <p> | ||
* | ||
* @param gc | ||
* The GC will draw on the underlying Image and is configured for the targeted zoom | ||
* @since 3.129 | ||
*/ | ||
void drawOn(GC gc); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.