Yes, you can do it in the water
as I did here, but you need a calm working spot well away from other boat traffic
You would also need to dramatically reduce the weight on-board to raise the boot stripe far enough up to work on prep and painting from a floating pontoon.
Think of removing Masts/Rigging/Ground Tackle/ all fuel and water as what is needed.
Alternately you could rig up a quiet spot to safely go aground enough to give the boot stripe clearance…. but that is a complicated process and as others have said… not recommended.
When I did SG in 07. it was for major cosmetic upgrades because of poor paint
adhesion when she was last painted before I bought her
Since I had found a quiet commercial
spot to put together a team the boat was gutted/masts off/ decks ground down to steel
So prepping and painting her in the water was a practical solution given the rest of the works
My next hull
painting will be done during dry-docking