mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-1981 - Checkpoint - Function Call Graph
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
[Defaults]
|
||||
|
||||
color.fcg.satellite.edge = rgba(0,0,0,0.1)
|
||||
color.bg.fcg.vertex.default = rgb(110, 197, 174) // chill green
|
||||
color.bg.fcg.vertex.toobig = color.palette.lightGray
|
||||
|
||||
color.bg.fcg.edge.primary.direct = rgb(143, 197, 143) // lightGreen
|
||||
color.bg.fcg.edge.primary.indirect = rgb(233, 233, 233) // lightGray
|
||||
|
||||
// the satellite gets too cluttered, so wash out the edges
|
||||
color.bg.fcg.edge.satellite.direct = rgba(0,0,0,0.1) // 'washed out black'
|
||||
color.bg.fcg.edge.satellite.indirect = rgba(125, 125, 125, 25) // 'washed out gray'
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
||||
// TODO dark colors
|
||||
// TODO color.bg.fcg.vertex.default = rgb(110, 197, 174) // chill green
|
||||
// TODO color.bg.fcg.vertex.toobig = color.palette.lightGray
|
||||
|
||||
// TODO color.bg.fcg.edge.primary.direct = rgb(143, 197, 143) // lightGreen
|
||||
// TODO color.bg.fcg.edge.primary.indirect = rgb(233, 233, 233) // lightGray
|
||||
|
||||
// the satellite gets too cluttered, so wash out the edges
|
||||
// TODO color.bg.fcg.edge.satellite.direct = rgba(0,0,0,0.1) // 'washed out black'
|
||||
// TODO color.bg.fcg.edge.satellite.indirect = rgba(125, 125, 125, 25) // 'washed out gray'
|
||||
@@ -26,6 +26,8 @@ import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import docking.theme.GColor;
|
||||
import docking.theme.GThemeDefaults.Colors.Palette;
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.graph.viewer.vertex.AbstractVisualVertex;
|
||||
@@ -41,9 +43,10 @@ import resources.ResourceManager;
|
||||
*/
|
||||
public class FcgVertex extends AbstractVisualVertex implements VertexShapeProvider {
|
||||
|
||||
// TODO to be made an option in an upcoming ticket
|
||||
public static final Color DEFAULT_VERTEX_SHAPE_COLOR = new Color(110, 197, 174);
|
||||
private static final Color TOO_BIG_VERTEX_SHAPE_COLOR = Color.LIGHT_GRAY;
|
||||
//@formatter:off
|
||||
public static final Color DEFAULT_VERTEX_SHAPE_COLOR = new GColor("color.bg.fcg.vertex.default");
|
||||
private static final Color TOO_BIG_VERTEX_SHAPE_COLOR = new GColor("color.bg.fcg.vertex.toobig ");
|
||||
//@formatter:on
|
||||
|
||||
public static final Icon NOT_ALLOWED_ICON = Icons.ERROR_ICON;
|
||||
private static final Icon EXPAND_ICON =
|
||||
@@ -312,8 +315,8 @@ public class FcgVertex extends AbstractVisualVertex implements VertexShapeProvid
|
||||
private void addToggleButtons() {
|
||||
|
||||
// hide the button background
|
||||
toggleInsButton.setBackground(new Color(255, 255, 255, 0));
|
||||
toggleOutsButton.setBackground(new Color(255, 255, 255, 0));
|
||||
toggleInsButton.setBackground(Palette.NO_COLOR);
|
||||
toggleOutsButton.setBackground(Palette.NO_COLOR);
|
||||
|
||||
Rectangle parentBounds = vertexImageLabel.getBounds();
|
||||
Dimension size = toggleInsButton.getPreferredSize();
|
||||
|
||||
@@ -21,13 +21,13 @@ import java.awt.Paint;
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import functioncalls.graph.FcgEdge;
|
||||
import ghidra.util.ColorUtils;
|
||||
|
||||
/**
|
||||
* Generates colors for a given {@link FcgEdge}
|
||||
*/
|
||||
public class FcgEdgePaintTransformer implements Function<FcgEdge, Paint> {
|
||||
|
||||
// private static final Paint LESS_IMPORTANT_COLOR = new Color(125, 125, 125, 75);
|
||||
private Color directColor;
|
||||
private Color indirectColor;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class FcgEdgePaintTransformer implements Function<FcgEdge, Paint> {
|
||||
alphad[0] = c;
|
||||
for (int i = 1; i < 10; i++) {
|
||||
double newAlpha = 255 - (i * 25.5);
|
||||
alphad[i] = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) newAlpha);
|
||||
alphad[i] = ColorUtils.withAlpha(c, (int) newAlpha);
|
||||
}
|
||||
return alphad;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package functioncalls.graph.view;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import docking.theme.GColor;
|
||||
import edu.uci.ics.jung.visualization.RenderContext;
|
||||
import functioncalls.graph.*;
|
||||
@@ -38,19 +36,14 @@ public class FcgComponent extends GraphComponent<FcgVertex, FcgEdge, FunctionCal
|
||||
private FcgVertexPaintTransformer vertexPaintTransformer =
|
||||
new FcgVertexPaintTransformer(FcgVertex.DEFAULT_VERTEX_SHAPE_COLOR);
|
||||
|
||||
private Color lightGreen = new Color(143, 197, 143);
|
||||
private Color lightGray = new Color(233, 233, 233);
|
||||
|
||||
// the satellite gets too cluttered, so wash out the edges
|
||||
private Color washedOutBlack = new GColor("color.fcg.satellite.edge");
|
||||
|
||||
private FcgEdgePaintTransformer edgePaintTransformer =
|
||||
new FcgEdgePaintTransformer(lightGreen, lightGray);
|
||||
new FcgEdgePaintTransformer(new GColor("color.bg.fcg.edge.primary.direct"),
|
||||
new GColor("color.bg.fcg.edge.primary.indirect"));
|
||||
private FcgEdgePaintTransformer satelliteEdgePaintTransformer =
|
||||
new FcgEdgePaintTransformer(washedOutBlack, new Color(125, 125, 125, 25));
|
||||
new FcgEdgePaintTransformer(new GColor("color.bg.fcg.edge.satellite.direct"),
|
||||
new GColor("color.bg.fcg.edge.satellite.indirect"));
|
||||
|
||||
FcgComponent(FunctionCallGraph g) {
|
||||
|
||||
setGraph(g);
|
||||
build();
|
||||
}
|
||||
@@ -75,7 +68,6 @@ public class FcgComponent extends GraphComponent<FcgVertex, FcgEdge, FunctionCal
|
||||
renderContext.setEdgeDrawPaintTransformer(edgePaintTransformer);
|
||||
renderContext.setArrowFillPaintTransformer(edgePaintTransformer);
|
||||
renderContext.setArrowDrawPaintTransformer(edgePaintTransformer);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user