Coder Social home page Coder Social logo

rasem's People

Contributors

aseldawy avatar meringu avatar papylhomme avatar xytis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rasem's Issues

Support for html-embedded SVGs

Rasem prefixes every generated SVG with a XML- and DOCTYPE-header.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="#{width}" height="#{height}" version="1.1"
  xmlns="http://www.w3.org/2000/svg">

There should be an option to disable this header when outputting directly into HTML code (i.e. embedding the SVG in HTML-code).

Thanks!

Transform

can not use the transform "style" to do things like rotation and scaling.
I forked and added code to "write_style(style)"
It works with text but still need to test with other objects
exp:
File.open("test.svg", "w") do |f|
Rasem::SVGImage.new(100, 100, f) do |f|
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "O", :font_family=>"Akho Desire", "font-size"=>24
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "I", :font_family=>"Akho Will", "font-size"=>24
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "A", :font_family=>"Akho Believe", "font-size"=>24, :transform=>" matrix(0,1,-1,0,0,0)"
end
end

Give meaningful stack trace

When the .rasem file has a syntax error or runtime error, we need the stack trace to point to the error in this file rather than a backtrace pointing to the gem source files

no implicit conversion of Symbol into Integer when instantiating SVGImage

i = Rasem::SVGImage.new(100, 100) do
  line(0, 0, 100, 100)
end
TypeError: no implicit conversion of Symbol into Integer
	from /.rvm/gems/ruby-2.3.3/gems/rasem-0.7.1/lib/rasem/svg_image.rb:426:in `[]'
	from /.rvm/gems/ruby-2.3.3/gems/rasem-0.7.1/lib/rasem/svg_image.rb:426:in `initialize'
	from (irb):17:in `new'
	from (irb):17
	from /.rvm/rubies/ruby-2.3.3/bin/irb:11:in `<main>'

Ruby 2.3.3
rasem-0.7.1

World Map Generator

Hi Ahmet,

your gem is look like awesome! I want to ask how to edit world map svg image with your gem? Can i open any file with it? And if i can, can i edit it and export to svg or other file type?

Thanks!
Ilker

rx and ry written when 0

Solution: change this line to set them to nil instead of 0, as (surprisingly) 0 && 0 is truthy.

I'd make a PR if there was any recent activity indicating it would be merged.

'scale' attribute causes feDisplacementMap attribute exception

I love this gem; I end up pulling it out of the toolbox for something about every six months.

Problem
Following the example at https://stackoverflow.com/questions/30229943/hand-drawing-crayon-style-for-svg-path, I tried to create a brush-stroke filter like:

filter(:id=>'strokeFilter') do
	feTurbulence(:baseFrequency=>"0.2", :numOctaves=>"3", :type=>"fractalNoise")
	feDisplacementMap(:xChannelSelector=>"R", :in=>"SourceGraphic", :'scale'=>"8")
end

and got:
"svg_image.rb:169:in `validate_attribute': feDisplacementMap does not support attribute transform"

It looks like validate_attributes(attributes) sees the 'scale' attribute and tries to translate it to a 'transform' attribute internally, but 'scale' is actually a valid attribute on feDisplacementMap.

Possible Solution
I modified validate_attributes like:

  def validate_attributes(attributes , tag )
    clean_attributes = {}
    transforms = {}
    styles = {}

    attributes.each do |attribute, value|
      if Rasem::SVG_TRANSFORM.include?(attribute) && !Rasem::SVG_STRUCTURE[@tag.to_sym][:attributes].include?(attribute.to_sym)
        transforms[attribute] = value
        ...

(adding the tag parameter and the && !Rasem::SVG_STRUCTURE...) and it seems to work fine now. I haven't tested anything else, though.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.