Method: HexaPDF::Content::Canvas#rendering_intent

Defined in:
lib/hexapdf/content/canvas.rb

#rendering_intent(intent = nil, &bk) ⇒ Object Also known as: rendering_intent=

:call-seq:

canvas.rendering_intent                       => current_rendering_intent
canvas.rendering_intent(intent)               => canvas
canvas.rendering_intent(intent) { block }     => canvas

The rendering intent is used to specify the intent on how colors should be rendered since sometimes compromises have to be made when the capabilities of an output device are not sufficient. The intent parameter can be one of the following symbols:

  • :AbsoluteColorimetric

  • :RelativeColorimetric

  • :Saturation

  • :Perceptual

Returns the current rendering intent (see GraphicsState#rendering_intent) when no argument is given. Otherwise sets the rendering intent using the intent argument and returns self. The setter version can also be called in the rendering_intent= form.

If the intent and a block are provided, the changed rendering intent is only active during the block by saving and restoring the graphics state.

Examples:

canvas.rendering_intent(:Perceptual)
canvas.rendering_intent                      # => :Perceptual
canvas.rendering_intent = :Saturation        # => :Saturation

canvas.rendering_intent(:Perceptual) do
  canvas.rendering_intent                    # => :Perceptual
end
canvas.rendering_intent                      # => :Saturation

See: PDF2.0 s8.6.5.8, RenderingIntent



867
868
869
# File 'lib/hexapdf/content/canvas.rb', line 867

def rendering_intent(intent = nil, &bk)
  gs_getter_setter(:rendering_intent, :ri, intent && RenderingIntent.normalize(intent), &bk)
end