Paint is estimated from wall area and the number of coats, against a known coverage rate.
Find the wall area
Multiply the room perimeter by the ceiling height. A 12 by 12 room with 8 foot walls has a perimeter of 48 feet, times 8, which is 384 square feet of wall.
Apply coverage and coats
One gallon of interior latex covers about 350 to 400 square feet per coat. Multiply your wall area by the number of coats, then divide by 375 as a working average. Two coats on 384 square feet is about 2 gallons.
Primer and deductions
Add primer for bare, patched or strongly coloured walls. You can leave normal doors and windows in the wall area as a buffer, but subtract large openings.