Use a vegetable peeler to take wide strips of peel from one blood orange and one lemon, avoiding the white pith. Then juice the citrus and strain out the seeds and pulp until you have 2 cups (480 ml) of juice.
Combine the juice, sugar, peel strips, cinnamon stick, cardamom and star anise in a small saucepan. Warm over medium-low heat, stirring, until the sugar has dissolved completely.
Bring to a gentle simmer and cook for 8–10 minutes, until slightly reduced and lightly syrupy. Do not let it boil hard, which dulls the fresh citrus flavor.
Take the pan off the heat. Add the rosemary sprig if using, cover and let the syrup steep for 20 minutes.
Strain through a fine-mesh strainer into a clean bottle or jar. Let cool, seal and refrigerate. The syrup thickens slightly as it chills.