!7 module WebCamPixelated > DynImageSurface { int width = 16; transient BufferedImage lastImage; start { doEvery(1000, rstUpdate()); } void enhanceFrame(Container f) { super.enhanceFrame(f); internalFramePopupMenuItem(f/JInternalFrame, "Width...", r { final JTextField tf = jtextfield(str(width)); showFormTitled("Set Pixelated Image Width", "Width:", tf, r { setFields(width := parseInt(gtt(tf)), lastImage := null) }); }); } visualize { JComponent c = super.visualize(); imageSurface.interpolationMode = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; ret c; } void update { if (imageSurface == null) ret; final BufferedImage img = dm_webCamImage(); temp tempAfterwards(r { lastImage = img }); if (img == null || img == lastImage) ret; setZoom(doubleRatio(img.getWidth(), width)); setImage(resizeImage(img, width)); } }