001package org.jfree.skija; 002 003import java.awt.*; 004 005/** 006 * A graphics device for SkijaGraphics2D. 007 */ 008public class SkijaGraphicsDevice extends GraphicsDevice { 009 010 private final String id; 011 012 GraphicsConfiguration defaultConfig; 013 014 /** 015 * Creates a new instance. 016 * 017 * @param id the id. 018 * @param defaultConfig the default configuration. 019 */ 020 public SkijaGraphicsDevice(String id, GraphicsConfiguration defaultConfig) { 021 this.id = id; 022 this.defaultConfig = defaultConfig; 023 } 024 025 /** 026 * Returns the device type. 027 * 028 * @return The device type. 029 */ 030 @Override 031 public int getType() { 032 return GraphicsDevice.TYPE_RASTER_SCREEN; 033 } 034 035 /** 036 * Returns the id string (defined in the constructor). 037 * 038 * @return The id string. 039 */ 040 @Override 041 public String getIDstring() { 042 return this.id; 043 } 044 045 /** 046 * Returns all configurations for this device. 047 * 048 * @return All configurations for this device. 049 */ 050 @Override 051 public GraphicsConfiguration[] getConfigurations() { 052 return new GraphicsConfiguration[] { getDefaultConfiguration() }; 053 } 054 055 /** 056 * Returns the default configuration for this device. 057 * 058 * @return The default configuration for this device. 059 */ 060 @Override 061 public GraphicsConfiguration getDefaultConfiguration() { 062 return this.defaultConfig; 063 } 064 065}