Dominique, We can do this with with one gallon to begin with.
If we let x= the amount of the one gallon that is the $1.20/gal then 1-x is the amount of the $1.40/gl because x+(1-x)=1
1.2*x+(1-x)*1.4=1.28 solving this gives x=.6 gal and 1-x=.4 gal
You can now use these fractions to calculate the amount needed for any amount.
If you wanted to make up 30 gallons of $1.28 gas you would use .6*30 or 18 gal of 1.20 gas and .4*30 or 12 gal of the 1.40 gas
18*1.2=21.60
12*1.4=16.80
This totals up to 30 gallons and cost $38.40 and the cost per gallon is 38.40/30=1.28
Jim