MCPcopy Create free account
hub / github.com/Logicalshift/flo_draw / decode_all_stream

Function decode_all_stream

canvas/src/decoding.rs:2164–2237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2162
2163 #[test]
2164 fn decode_all_stream() {
2165 let all = vec![
2166 Draw::Path(PathOp::NewPath),
2167 Draw::Path(PathOp::Move(10.0, 15.0)),
2168 Draw::Path(PathOp::Line(20.0, 42.0)),
2169 Draw::Path(PathOp::BezierCurve(((1.0, 2.0), (3.0, 4.0)), (5.0, 6.0))),
2170 Draw::Path(PathOp::ClosePath),
2171 Draw::Fill,
2172 Draw::FillTexture(TextureId(42), (1.0, 2.0), (3.0, 4.0)),
2173 Draw::Stroke,
2174 Draw::LineWidth(23.0),
2175 Draw::LineWidthPixels(43.0),
2176 Draw::LineJoin(LineJoin::Bevel),
2177 Draw::LineCap(LineCap::Round),
2178 Draw::WindingRule(WindingRule::EvenOdd),
2179 Draw::NewDashPattern,
2180 Draw::DashLength(56.0),
2181 Draw::DashOffset(13.0),
2182 Draw::StrokeColor(Color::Rgba(0.1, 0.2, 0.3, 0.4)),
2183 Draw::FillColor(Color::Rgba(0.2, 0.3, 0.4, 0.5)),
2184 Draw::FillTexture(TextureId(23), (42.0, 43.0), (44.0, 45.0)),
2185 Draw::FillGradient(GradientId(24), (42.0, 43.0), (44.0, 45.0)),
2186 Draw::FillTransform(Transform2D::identity()),
2187 Draw::BlendMode(BlendMode::Lighten),
2188 Draw::IdentityTransform,
2189 Draw::CanvasHeight(81.0),
2190 Draw::CenterRegion((6.0, 7.0), (8.0, 9.0)),
2191 Draw::MultiplyTransform(Transform2D([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]])),
2192 Draw::Unclip,
2193 Draw::Store,
2194 Draw::Restore,
2195 Draw::FreeStoredBuffer,
2196 Draw::PushState,
2197 Draw::PopState,
2198 Draw::ClearCanvas(Color::Rgba(0.1, 0.2, 0.3, 0.4)),
2199 Draw::Layer(LayerId(21)),
2200 Draw::ClearLayer,
2201 Draw::ClearAllLayers,
2202 Draw::SwapLayers(LayerId(1), LayerId(2)),
2203 Draw::Path(PathOp::NewPath),
2204 Draw::Sprite(SpriteId(1000)),
2205 Draw::ClearSprite,
2206 Draw::SpriteTransform(SpriteTransform::Translate(4.0, 5.0)),
2207 Draw::SpriteTransform(SpriteTransform::Transform2D(Transform2D::scale(3.0, 4.0))),
2208 Draw::DrawSprite(SpriteId(1300)),
2209 Draw::Texture(TextureId(42), TextureOp::Create(1024, 768, TextureFormat::Rgba)),
2210 Draw::Texture(TextureId(43), TextureOp::Free),
2211 Draw::Texture(TextureId(44), TextureOp::SetBytes(2, 3, 4, 5, Arc::new(vec![1,2,3,4,5]))),
2212 Draw::Texture(TextureId(45), TextureOp::FillTransparency(0.5)),
2213
2214 Draw::Gradient(GradientId(42), GradientOp::Create(Color::Rgba(0.1, 0.2, 0.3, 0.4))),
2215 Draw::Gradient(GradientId(44), GradientOp::AddStop(0.5, Color::Rgba(0.1, 0.2, 0.3, 0.4))),
2216 ];
2217 let mut encoded = String::new();
2218 all.encode_canvas(&mut encoded);
2219
2220 println!("{:?}", encoded);
2221

Callers

nothing calls this directly

Calls 3

decode_drawing_streamFunction · 0.85
encode_canvasMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected