
// hairline.hpp - misc. interfaces from hairline.cpp

#ifndef __hairline_hpp__
#define __hairline_hpp__

#include <vector>

using std::vector;

#include <Cg/vector/xyzw.hpp>
#include <Cg/double.hpp>
#include <Cg/vector.hpp>
#include <Cg/matrix.hpp>

#include "countof.h"

#include "Paint.hpp"
#include "polar/IndexedStrokedPath.hpp"

extern bool show_status_text;

extern void postMainWindowRedisplay();
extern void postAllWindowsRedisplay();
extern void postGraphingWindowsRedisplay();

extern void setMainWindow();
extern void setSupersampledMainWindow(bool use_supersample);

extern Paint current_paint;

extern GLenum currentGLJoinStyle();

struct JoinStyleConfig {
    const char *name;
    GLenum gl_enum;
    bool miter_mode;
};
extern const JoinStyleConfig joinStyleConfig[];
extern size_t joinStyleConfigCount();

#include "PathContainer.hpp"

extern PathContainer simple;

#include "gl_framebuffer.hpp"

extern GLFramebufferCapabilities capabilities;

extern void setBackground();
extern float3 getBackgroundContrastColor();
extern bool isBackgroundWhite();
extern const char* backgroundString();

extern void establishFramebuffer(GLFramebuffer*& fb, int w, int h);
extern void updateColorSpace(GLFramebuffer *fb);

extern void initModelMatrix();
extern void initModelAndViewMatrices();

extern bool outline;
extern bool overlay_outline;
extern bool skip_paint_update;

extern void dumpCorners();

extern float simple_opacity;

extern void patchControlPoints(float3 link_control_points[6], const StrokeLink& link);

extern float arc_length_offset;
extern bool force_affine;
extern bool conic_support;
extern bool trivial_culling;
extern bool view_conservative_rasterization;
extern bool draw_filled;
extern bool native_quadratics;
extern int report_gl_stats_info;  // 0 == silent, 1 == visual results, 2 == printed results
extern bool dump_buffers;

extern int background;
extern int curveType;

#include "color_space.hpp"

extern ColorSpace color_space;

extern float max_turning_angle_delta;

extern int simple_color_ndx;
extern void setSimpleColor();

extern float3x3 modelview;
extern void validateModelview();

extern float2 project(float3 v);

extern int canvas_width;
extern int canvas_height;

extern void glVertex2f(const float2& v);
extern void glVertex2fw(const float3& v);

extern float getCurrentTextureScale();
extern void advanceTexture();

extern vector<float> current_dash_pattern;
extern float current_dash_offset;

extern int color_by_segment_length;  // see simple_path.cpp, Alt-C toggles

#endif // __hairline_hpp__
