Search code examples
javaswtpixel

How to draw square pixel with different colors using SWT application


I am working on a fluid simulation application using SWT and want to draw the final calculated density of fluid back to UI. Now I am thinking about using SWT canvas and GC, but GC seems only for drawing shapes and lines, without the ability to draw colored pixels

There are many simulation app in the website but none is implemented by SWT. Below is the expected result for this application:

enter image description here


Solution

  • Use GC.drawPoint to draw a single pixel, the colour will be that set with GC.setForeground.