code: public void clear()
      {
          if (LienzoCore.get().getLayerClearMode() == LayerClearMode.CLEAR)
          {
              final Context2D context = getContext();
  
              if (null != context)
              {
                  context.clearRect(0, 0, getWidth(), getHeight());
              }
          }
          else
          {
              setPixelSize(getWidth(), getHeight());
          }
      }
docs: Clears the layer.