gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'agg-plot/utils.cpp')
-rw-r--r--agg-plot/utils.cpp 32
1 files changed, 28 insertions, 4 deletions
diff --git a/agg-plot/utils.cpp b/agg-plot/utils.cpp
index 6b834ee7..b74a4736 100644
--- a/agg-plot/utils.cpp
+++ b/agg-plot/utils.cpp
@@ -2,15 +2,39 @@
#include <stdlib.h>
#include <limits.h>
+#include <string>
+#include <stdarg.h>
+
#include "utils.h"
void
trans_affine_compose (agg::trans_affine& a, const agg::trans_affine& b)
{
+ double a_tx = a.tx, a_ty = a.ty;
+
a.premultiply(b);
- double a_tx = b.sx * a.tx + b.shx * a.ty + b.tx;
- double a_ty = b.shy * a.tx + b.sy * a.ty + b.ty;
- a.tx = a_tx;
- a.ty = a_ty;
+ a.tx = b.sx * a_tx + b.shx * a_ty + b.tx;
+ a.ty = b.shy * a_tx + b.sy * a_ty + b.ty;
+}
+
+void
+string_printf (std::string &s, const char *fmt, ...)
+{
+ va_list ap;
+ char *buf;
+ int n;
+
+ va_start (ap, fmt);
+
+ n = vasprintf (&buf, fmt, ap);
+ if (n <= 0)
+ {
+ s = "";
+ return;
+ }
+
+ s = (const char *) buf;
+ free (buf);
+ va_end (ap);
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月28日 15:41:11 +0000

AltStyle によって変換されたページ (->オリジナル) /