Buggy code:
public class Graphics2D extends geogebra . common . awt . Graphics2D { protected final Canvas canvas ; private final Context2d context ; private Font currentFont = new Font ( "normal" ) ; public Graphics2D ( Canvas canvas ) { } @ Override public void draw3DRect ( int x , int y , int width , int height , boolean raised ) { } @ Override public void fill3DRect ( int x , int y , int width , int height , boolean raised ) { } public void draw ( Shape shape ) { } @ Override public boolean drawImage ( Image img , AffineTransform xform , ImageObserver obs ) { } public void drawImage ( BufferedImageAdapter img , BufferedImageOp op , int x , int y ) { <START_BUG> context . drawImage ( ( ( BufferedImage ) ( img ) ) , x , y ) ; <END_BUG> } @ Override public void drawRenderedImage ( RenderedImage img , AffineTransform xform ) { } @ Override public void drawRenderableImage ( RenderableImage img , AffineTransform xform ) { } @ Override public void drawString ( String str , int x , int y ) { } @ Override public void drawString ( String str , float x , float y ) { } @ Override public void drawString ( AttributedCharacterIterator iterator , int x , int y ) { } @ Override public void drawString ( AttributedCharacterIterator iterator , float x , float y ) { } @ Override public void drawGlyphVector ( GlyphVector g , float x , float y ) { } public void fill ( Shape shape ) { } public boolean hit ( Rectangle rect , Shape s , boolean onStroke ) { } @ Override public GraphicsConfiguration getDeviceConfiguration ( ) { } @ Override public void setComposite ( Composite comp ) { } @ Override public void setPaint ( Paint paint ) { } @ Override public void setStroke ( BasicStroke stroke ) { } @ Override public void setRenderingHint ( Key hintKey , Object hintValue ) { } @ Override public Object getRenderingHint ( Key hintKey ) { } @ Override public void setRenderingHints ( Map < ? , ? > hints ) { } @ Override public void addRenderingHints ( Map < ? , ? > hints ) { } @ Override public RenderingHints getRenderingHints ( ) { } @ Override public void translate ( int x , int y ) { } @ Override public void translate ( double tx , double ty ) { } @ Override public void rotate ( double theta ) { } @ Override public void rotate ( double theta , double x , double y ) { } @ Override public void scale ( double sx , double sy ) { } @ Override public void shear ( double shx , double shy ) { } @ Override public void transform ( AffineTransform Tx ) { } @ Override public void setTransform ( AffineTransform Tx ) { } @ Override public AffineTransform getTransform ( ) { } @ Override public Paint getPaint ( ) { } @ Override public Composite getComposite ( ) { } @ Override public void setBackground ( Color color ) { } @ Override public Color getBackground ( ) { } @ Override public BasicStroke getStroke ( ) { } public void clip ( Shape s ) { } @ Override public FontRenderContext getFontRenderContext ( ) { } @ Override public Color getColor ( ) { } @ Override public geogebra . common . awt . Font getFont ( ) { } public void setFont ( Font font ) { } @ Override public void setPaint ( Color fillColor ) { } public void setCoordinateSpaceHeight ( int height ) { } public void setCoordinateSpaceWidth ( int width ) { } public int getOffsetWidth ( ) { } public int getOffsetHeight ( ) { } public int getCoordinateSpaceWidth ( ) { } public int getCoordinateSpaceHeight ( ) { } public int getAbsoluteTop ( ) { } public int getAbsoluteLeft ( ) { } @ Override public void setFont ( geogebra . common . awt . Font font ) { } @ Override public void setColor ( Color selColor ) { } @ Override public void draw ( Object shape ) { } @ Override public void fill ( Object shape ) { } @ Override public void clip ( geogebra . common . awt . Shape s ) { } public void drawImage ( BufferedImageAdapter img , int x , int y , BufferedImageOp op ) { } public void fillRect ( int i , int j , int k , int l ) { } public void drawLine ( int x1 , int y1 , int x2 , int y2 ) { } public void setComposite ( AlphaComposite alphaComp ) { } }

Fix:
context . drawImage ( ( ( geogebra . web . kernel . gawt . BufferedImage ) ( img ) ) . getImageElement ( ) , x , y ) ;