  Fundamental bounds on antenna gain are found via convex optimization of the
current density in a prescribed region. Various constraints are considered,
including self-resonance and only partial control of the current distribution.
Derived formulas are valid for arbitrarily shaped radiators of a given
conductivity. All the optimization tasks are reduced to eigenvalue problems,
which are solved efficiently. The second part of the paper deals with
superdirectivity and its associated minimal costs in efficiency and Q-factor.
The paper is accompanied with a series of examples practically demonstrating
the relevance of the theoretical framework and entirely spanning wide range of
material parameters and electrical sizes used in antenna technology. Presented
results are analyzed from a perspective of effectively radiating modes. In
contrast to a common approach utilizing spherical modes, the radiating modes of
a given body are directly evaluated and analyzed here. All crucial mathematical
steps are reviewed in the appendices, including a series of important
subroutines to be considered making it possible to reduce the computational
burden associated with the evaluation of electrically large structures and
structures of high conductivity.
