use std::mem; use std::slice; use std::sync::atomic::AtomicUsize; use winapi::shared::guiddef::REFIID; use winapi::shared::minwindef::{UINT, ULONG}; use winapi::shared::winerror::S_OK; use winapi::um::d2d1::{ID2D1SimplifiedGeometrySink, ID2D1SimplifiedGeometrySinkVtbl}; use winapi::um::d2d1::{D2D1_BEZIER_SEGMENT, D2D1_FIGURE_BEGIN, D2D1_FIGURE_END}; use winapi::um::d2d1::{D2D1_FIGURE_END_CLOSED, D2D1_FILL_MODE, D2D1_PATH_SEGMENT, D2D1_POINT_2F}; use winapi::um::unknwnbase::{IUnknown, IUnknownVtbl}; use winapi::um::winnt::HRESULT;
unsafeextern"system"fn GeometrySinkImpl_BeginFigure(
this: *mut ID2D1SimplifiedGeometrySink,
start_point: D2D1_POINT_2F,
_: D2D1_FIGURE_BEGIN,
) { let this = GeometrySinkImpl::from_interface(this);
(*this)
.outline_builder
.move_to(start_point.x, start_point.y)
}
unsafeextern"system"fn GeometrySinkImpl_EndFigure(
this: *mut ID2D1SimplifiedGeometrySink,
figure_end: D2D1_FIGURE_END,
) { let this = GeometrySinkImpl::from_interface(this); if figure_end == D2D1_FIGURE_END_CLOSED {
(*this).outline_builder.close()
}
}
unsafeextern"system"fn GeometrySinkImpl_AddLines(
this: *mut ID2D1SimplifiedGeometrySink,
points: *const D2D1_POINT_2F,
points_count: UINT,
) { let this = GeometrySinkImpl::from_interface(this); let points = slice::from_raw_parts(points, points_count as usize); for point in points {
(*this).outline_builder.line_to(point.x, point.y)
}
}
unsafeextern"system"fn GeometrySinkImpl_AddBeziers(
this: *mut ID2D1SimplifiedGeometrySink,
beziers: *const D2D1_BEZIER_SEGMENT,
beziers_count: UINT,
) { let this = GeometrySinkImpl::from_interface(this); let beziers = slice::from_raw_parts(beziers, beziers_count as usize); for bezier in beziers {
(*this).outline_builder.curve_to(
bezier.point1.x,
bezier.point1.y,
bezier.point2.x,
bezier.point2.y,
bezier.point3.x,
bezier.point3.y,
)
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.