# File lib/rubygame/surface.rb, line 514
  def convert( other=nil, flags=nil )

    if other.nil?
      begin
        other = Rubygame::ScreenFFI.get_surface
      rescue Rubygame::SDLError
        raise( Rubygame::SDLError, "Cannot convert Surface with no target " +
               "given and no Screen made: #{SDL.GetError()}" )
      end
    end

    flags = Rubygame.collapse_flags(flags)

    newsurf =
      if( Rubygame.init_video_system() == 0 )
        SDL.ConvertSurface( @struct, other.struct.format, flags )
      else
        nil
      end

    if( newsurf.nil? or newsurf.pointer.null?)
      raise( Rubygame::SDLError,
             "Could not convert the Surface: #{SDL.GetError()}" )
    end

    # Wrap it
    return self.class.new( newsurf )
  end