setThinLineAA

Requires FM 1.0 Beta 8.5 (Nov 2007) or newer

Syntax

void setThinLineAA(int x1, int y1, int x2, int y2, int color)

Arguments

x1
Horizontal offset from the left edge of the start of the line, in pixels.
y1
Vertical offset from the top edge of the start of the line, in pixels.
x2
Horizontal offset from the left edge of the end of the line, in pixels.
y2
Vertical offset from the top edge of the end of the line, in pixels.
color
Color value for the line.

Description

Render an anti-aliased line to an OWNERDRAW control.

Example

%fml

ctl[3]: OWNERDRAW(drawitem), Pos=(300,50), Size=(100, 100)

OnFilterStart: {

  const int x = HDBUsToPixels(getCtlPos(n, 3));
  const int y = VDBUsToPixels(getCtlPos(n, 3));

  // Start drawing on the OWNERDRAW
  startSetPixel(3);

  // Fill the OWNERDRAW with black pixels
  setFill(RGB(0,0,0));

  // Draw a diagonal red line
  setPenWidth(1);
  setLine(x, 0, 0, y, COLOR(RED));

  // Draw a diagonal yellow antialiased line
  setThinLineAA(0, 0, x, y, COLOR(YELLOW));

  // Stop drawing to the OWNERDRAW
  endSetPixel(3);

  return true;
}

See Also

OWNERDRAW, startSetPixel, HDBUsToPixels, VDBUsToPixels, setFill, setLine, endSetPixel