tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AAStroke.h (1639B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef MOZILLA_GFX_AA_STROKE_H
      8 #define MOZILLA_GFX_AA_STROKE_H
      9 
     10 #include <stddef.h>
     11 
     12 namespace AAStroke {
     13 
     14 enum class LineCap { Round, Square, Butt };
     15 enum class LineJoin { Round, Miter, Bevel };
     16 struct StrokeStyle {
     17  float width;
     18  LineCap cap;
     19  LineJoin join;
     20  float miter_limit;
     21 };
     22 struct Stroker;
     23 struct OutputVertex {
     24  float x;
     25  float y;
     26  float coverage;
     27 };
     28 struct VertexBuffer {
     29  OutputVertex* data;
     30  size_t len;
     31 };
     32 
     33 extern "C" {
     34 Stroker* aa_stroke_new(const StrokeStyle* style,
     35                       OutputVertex* output_ptr = nullptr,
     36                       size_t output_capacity = 0);
     37 void aa_stroke_move_to(Stroker* s, float x, float y, bool closed);
     38 void aa_stroke_line_to(Stroker* s, float x, float y, bool end);
     39 void aa_stroke_curve_to(Stroker* s, float c1x, float c1y, float c2x, float c2y,
     40                        float x, float y, bool end);
     41 void aa_stroke_close(Stroker* s);
     42 VertexBuffer aa_stroke_finish(Stroker* s);
     43 VertexBuffer aa_stroke_filled_circle(float cx, float cy, float radius,
     44                                     OutputVertex* output_ptr = nullptr,
     45                                     size_t output_capacity = 0);
     46 void aa_stroke_vertex_buffer_release(VertexBuffer vb);
     47 void aa_stroke_release(Stroker* s);
     48 };
     49 
     50 }  // namespace AAStroke
     51 
     52 #endif  // MOZILLA_GFX_AA_STROKE_H