# Idea for subclassing java.awt.Paint in order to use a sketch as a raster implementation of the pure Java Paint class

**URL:** <https://discourse.processing.org/t/idea-for-subclassing-java-awt-paint-in-order-to-use-a-sketch-as-a-raster-implementation-of-the-pure-java-paint-class/35807>\
**Category:** Development\
**Created:** [March 18, 2022, 1:35am UTC](https://discourse.processing.org/t/idea-for-subclassing-java-awt-paint-in-order-to-use-a-sketch-as-a-raster-implementation-of-the-pure-java-paint-class/35807 "2022-03-18T01:35:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![istinn](https://avatars.discourse-cdn.com/v4/letter/i/c4cdca/32.png) [@istinn](https://discourse.processing.org/u/istinn)\
**Post date:** [March 18, 2022, 1:35am UTC](https://discourse.processing.org/t/idea-for-subclassing-java-awt-paint-in-order-to-use-a-sketch-as-a-raster-implementation-of-the-pure-java-paint-class/35807/1 "2022-03-18T01:35:34Z")

</div>

I would like to make some notes and expose an idea about the possible use of the paint java class along side with processing.  
The idea is to create a “new java class that implements Paint” and use it as a graphics2d capability lets say like a: setPaint(processingpaint);  
I have found 2 old but interesting posts that share the same principle

> **[Subclassing java.awt.Paint](https://drj11.wordpress.com/2007/04/02/subclassing-javaawtpaint/)**
>
> In the good old days you could walk into your local electronic consumer goods stores and walk up to any one of a variety of intriguing and odd 8-bit microcomputers and proclaim one’s fame by …

> **[Procedural Paint in Java: Perlin noise](https://asserttrue.blogspot.com/2010/02/procedural-paint-in-java-perlin-noise.html)**
>
> A few days ago , I showed how to implement java.awt.Paint in a way that lets you vary the paint appearance according to the x-y position of...

Having used those extended paint methods to fill shapes in native java successfully with various perlin noise implementations, I was wondering if it is possible to think of a new paint class that can render the contents of a processing sketch (in pure java) via the Psurface or the Pimage canvas, as the Paint class return is a regular raster (much like the color and texturepaint subclasses). This “ProcessingPaint” Paint class implementation would have the ability to render the processing x,y canvas, use Affine transforms, pixel perfect scaling etc. This apparently is applicable to specific sketches that render static pixels, not sure about animations or moving vectors. Obviously only for the JAVA2D renderer, many possibilities to use it in pure java as a fill to shapes etc.

I am not familiar with that kind of context, so I am just sharing the idea in order to see what are the possibilities of such an integration, and the opinion of the java experts out there. Thanks…
