Skip to content

TextObjectFilterRender implementation guide #1700

@OsamuBlack

Description

@OsamuBlack

Hi Pedro,

I was setting up text using the TextObjectFilterRender and got most things to work. The issue I am facing is with scaling and positioning.

  • All texts are stretched to the same width, and it also gets stretched
  • Changing the position by one causes it to move by more than 1 px.

Code:

  val text = TextObjectFilterRender()

  text.setText(
      it.text,
      it.textSize,
      Color.WHITE,
      Typeface.BOLD
  )

  text.setPosition(
      it.x,
      it.y
  )

  val isPortrait = height > width;

  if (isPortrait)
      text.setPreviewSize(
          height,
          width,
      )
  else
      text.setPreviewSize(
          width,
          height,
      )

  rtmpCamera.getGlInterface().addFilter(text)

Values:

textWithPosition = {ArrayList@10356}  size = 3
 0 = {
  text = "Live Stream"
  
  textSize = 300.0
  x = 2.0
  y = 2.0
}
 1 = {
  text = "1600"
  
  textSize = 300.0
  x = 2.0
  y = 8.0
}
 2 = {
  text = "1200"
  
  textSize = 300.0
  x = 2.0
  y = 16.0
}

width = 720
height = 1337

Source 2025-01-12 at 14 32 57_44f0be4c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions